lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject [1/2] lucene-solr:master: SOLR-9966: Convert/migrate tests using EasyMock to Mockito [Forced Update!]
Date Sun, 19 Feb 2017 00:01:12 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master cbf0f8383 -> 46ef9256b (forced update)


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/46ef9256/solr/licenses/easymock-LICENSE-MIT.txt
----------------------------------------------------------------------
diff --git a/solr/licenses/easymock-LICENSE-MIT.txt b/solr/licenses/easymock-LICENSE-MIT.txt
deleted file mode 100644
index 1a983c7..0000000
--- a/solr/licenses/easymock-LICENSE-MIT.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-EasyMock 2 License (MIT License)
-
-Copyright (c) 2001-2006 OFFIS, Tammo Freese.
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and
-associated documentation files (the "Software"), to deal in the Software without restriction,
including
- without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or
- sell copies of the Software, and to permit persons to whom the Software is furnished to
do so, subject
-  to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or
substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT
-LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/46ef9256/solr/solrj/ivy.xml
----------------------------------------------------------------------
diff --git a/solr/solrj/ivy.xml b/solr/solrj/ivy.xml
index ae7d02b..f008fd2 100644
--- a/solr/solrj/ivy.xml
+++ b/solr/solrj/ivy.xml
@@ -40,8 +40,9 @@
     <dependency org="org.slf4j" name="jcl-over-slf4j" rev="${/org.slf4j/jcl-over-slf4j}"
conf="compile"/>
 
     <dependency org="org.slf4j" name="slf4j-log4j12" rev="${/org.slf4j/slf4j-log4j12}"
conf="test"/>
-    <dependency org="org.easymock" name="easymock" rev="${/org.easymock/easymock}" conf="test"/>
-    <dependency org="cglib" name="cglib-nodep" rev="${/cglib/cglib-nodep}" conf="test"/>
+
+    <dependency org="org.mockito" name="mockito-core" rev="${/org.mockito/mockito-core}"
conf="test"/>
+    <dependency org="net.bytebuddy" name="byte-buddy" rev="${/net.bytebuddy/byte-buddy}"
conf="test"/>
     <dependency org="org.objenesis" name="objenesis" rev="${/org.objenesis/objenesis}"
conf="test"/>
 
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/46ef9256/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java
b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java
index c144890..d260b02 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java
@@ -31,24 +31,17 @@ import java.util.function.Function;
 
 import com.google.common.collect.ImmutableSet;
 import org.apache.http.NoHttpResponseException;
-import org.apache.lucene.util.Constants;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.common.cloud.ClusterState;
 import org.apache.solr.common.cloud.DocCollection;
 import org.apache.solr.common.util.NamedList;
-import org.easymock.EasyMock;
-import org.junit.BeforeClass;
+import static org.mockito.Mockito.*;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 
 public class CloudSolrClientCacheTest extends SolrTestCaseJ4 {
 
-  @BeforeClass
-  public static void beforeClass() throws Exception {
-    assumeFalse("SOLR-9893: EasyMock does not work with Java 9", Constants.JRE_IS_MINIMUM_JAVA9);
-  }
-  
   public void testCaching() throws Exception {
     String collName = "gettingstarted";
     Set<String> livenodes = new HashSet<>();
@@ -108,12 +101,10 @@ public class CloudSolrClientCacheTest extends SolrTestCaseJ4 {
 
 
   private LBHttpSolrClient getMockLbHttpSolrClient(Map<String, Function> responses)
throws Exception {
-    LBHttpSolrClient mockLbclient = EasyMock.createMock(LBHttpSolrClient.class);
-    EasyMock.reset(mockLbclient);
+    LBHttpSolrClient mockLbclient = mock(LBHttpSolrClient.class);
 
-    mockLbclient.request(EasyMock.anyObject(LBHttpSolrClient.Req.class));
-    EasyMock.expectLastCall().andAnswer(() -> {
-      LBHttpSolrClient.Req req = (LBHttpSolrClient.Req) EasyMock.getCurrentArguments()[0];
+    when(mockLbclient.request(any(LBHttpSolrClient.Req.class))).then(invocationOnMock ->
{
+      LBHttpSolrClient.Req req = invocationOnMock.getArgument(0);
       Function f = responses.get("request");
       if (f == null) return null;
       Object res = f.apply(null);
@@ -122,12 +113,7 @@ public class CloudSolrClientCacheTest extends SolrTestCaseJ4 {
       rsp.rsp = (NamedList<Object>) res;
       rsp.server = req.servers.get(0);
       return rsp;
-    }).anyTimes();
-
-    mockLbclient.getHttpClient();
-    EasyMock.expectLastCall().andAnswer(() -> null).anyTimes();
-
-    EasyMock.replay(mockLbclient);
+    });
     return mockLbclient;
   }
 


Mime
View raw message