From: Emmanuel Bourg <ebourg@apache.org>
Date: Mon, 16 Jan 2023 23:22:18 +0100
Subject: Fixes the compatibility with the version of Easymock in Debian

Forwarded: no
---
 .../valves/TestCrawlerSessionManagerValve.java     | 28 +++++++++++-----------
 1 file changed, 14 insertions(+), 14 deletions(-)

--- a/test/org/apache/catalina/valves/TestCrawlerSessionManagerValve.java
+++ b/test/org/apache/catalina/valves/TestCrawlerSessionManagerValve.java
@@ -57,13 +57,13 @@ public class TestCrawlerSessionManagerVa
         CrawlerSessionManagerValve valve = new CrawlerSessionManagerValve();
         valve.setCrawlerIps("216\\.58\\.206\\.174");
         valve.setCrawlerUserAgents(valve.getCrawlerUserAgents());
-        valve.setNext(EasyMock.createMock(Valve.class));
+        valve.setNext((Valve) EasyMock.createMock(Valve.class));
         HttpSession session = createSessionExpectations(valve, true);
         Request request = createRequestExpectations("216.58.206.174", session, true);
 
         EasyMock.replay(request, session);
 
-        valve.invoke(request, EasyMock.createMock(Response.class));
+        valve.invoke(request, (Response) EasyMock.createMock(Response.class));
 
         EasyMock.verify(request, session);
     }
@@ -73,13 +73,13 @@ public class TestCrawlerSessionManagerVa
         CrawlerSessionManagerValve valve = new CrawlerSessionManagerValve();
         valve.setCrawlerIps("216\\.58\\.206\\.174");
         valve.setCrawlerUserAgents(valve.getCrawlerUserAgents());
-        valve.setNext(EasyMock.createMock(Valve.class));
+        valve.setNext((Valve) EasyMock.createMock(Valve.class));
         HttpSession session = createSessionExpectations(valve, false);
         Request request = createRequestExpectations("127.0.0.1", session, false);
 
         EasyMock.replay(request, session);
 
-        valve.invoke(request, EasyMock.createMock(Response.class));
+        valve.invoke(request, (Response) EasyMock.createMock(Response.class));
 
         EasyMock.verify(request, session);
     }
@@ -90,7 +90,7 @@ public class TestCrawlerSessionManagerVa
         valve.setCrawlerUserAgents(valve.getCrawlerUserAgents());
         valve.setHostAware(true);
         valve.setContextAware(true);
-        valve.setNext(EasyMock.createMock(Valve.class));
+        valve.setNext((Valve) EasyMock.createMock(Valve.class));
 
         verifyCrawlingLocalhost(valve, "localhost");
         verifyCrawlingLocalhost(valve, "example.invalid");
@@ -102,7 +102,7 @@ public class TestCrawlerSessionManagerVa
         valve.setCrawlerUserAgents(valve.getCrawlerUserAgents());
         valve.setHostAware(true);
         valve.setContextAware(true);
-        valve.setNext(EasyMock.createMock(Valve.class));
+        valve.setNext((Valve) EasyMock.createMock(Valve.class));
 
         verifyCrawlingContext(valve, "/examples");
         verifyCrawlingContext(valve, null);
@@ -113,7 +113,7 @@ public class TestCrawlerSessionManagerVa
         CrawlerSessionManagerValve valve = new CrawlerSessionManagerValve();
         valve.setCrawlerIps("216\\.58\\.206\\.174");
         valve.setCrawlerUserAgents(valve.getCrawlerUserAgents());
-        valve.setNext(EasyMock.createMock(Valve.class));
+        valve.setNext((Valve) EasyMock.createMock(Valve.class));
         valve.setSessionInactiveInterval(0);
         StandardSession session = new StandardSession(TEST_MANAGER);
         session.setId("id");
@@ -123,7 +123,7 @@ public class TestCrawlerSessionManagerVa
 
         EasyMock.replay(request);
 
-        valve.invoke(request, EasyMock.createMock(Response.class));
+        valve.invoke(request, (Response) EasyMock.createMock(Response.class));
 
         EasyMock.verify(request);
 
@@ -142,7 +142,7 @@ public class TestCrawlerSessionManagerVa
 
         EasyMock.replay(request, session);
 
-        valve.invoke(request, EasyMock.createMock(Response.class));
+        valve.invoke(request, (Response) EasyMock.createMock(Response.class));
 
         EasyMock.verify(request, session);
     }
@@ -156,14 +156,14 @@ public class TestCrawlerSessionManagerVa
 
         EasyMock.replay(request, session);
 
-        valve.invoke(request, EasyMock.createMock(Response.class));
+        valve.invoke(request, (Response) EasyMock.createMock(Response.class));
 
         EasyMock.verify(request, session);
     }
 
 
     private HttpSession createSessionExpectations(CrawlerSessionManagerValve valve, boolean isBot) {
-        HttpSession session = EasyMock.createMock(HttpSession.class);
+        HttpSession session = (HttpSession) EasyMock.createMock(HttpSession.class);
         if (isBot) {
             EasyMock.expect(session.getId()).andReturn("id").times(1);
             session.setAttribute(EasyMock.eq(valve.getClass().getName()),
@@ -182,7 +182,7 @@ public class TestCrawlerSessionManagerVa
 
     private Request createRequestExpectations(String ip, HttpSession session, boolean isBot, String hostname,
             String contextPath, String userAgent) {
-        Request request = EasyMock.createMock(Request.class);
+        Request request = (Request) EasyMock.createMock(Request.class);
         EasyMock.expect(request.getRemoteAddr()).andReturn(ip);
         EasyMock.expect(request.getRemoteAddr()).andReturn(ip);
         EasyMock.expect(request.getHost()).andReturn(simpleHostWithName(hostname));
@@ -198,7 +198,7 @@ public class TestCrawlerSessionManagerVa
     }
 
     private Host simpleHostWithName(String hostname) {
-        Host host = EasyMock.createMock(Host.class);
+        Host host = (Host) EasyMock.createMock(Host.class);
         EasyMock.expect(host.getName()).andReturn(hostname);
         EasyMock.replay(host);
         return host;
@@ -208,7 +208,7 @@ public class TestCrawlerSessionManagerVa
         if (contextPath == null) {
             return null;
         }
-        Context context = EasyMock.createMock(Context.class);
+        Context context = (Context) EasyMock.createMock(Context.class);
         EasyMock.expect(context.getName()).andReturn(contextPath);
         EasyMock.replay(context);
         return context;
