diff --git a/src/main/java/com/weirddev/testme/intellij/template/context/MockitoMockBuilder.java b/src/main/java/com/weirddev/testme/intellij/template/context/MockitoMockBuilder.java index 5568c533..c8af7031 100644 --- a/src/main/java/com/weirddev/testme/intellij/template/context/MockitoMockBuilder.java +++ b/src/main/java/com/weirddev/testme/intellij/template/context/MockitoMockBuilder.java @@ -240,21 +240,26 @@ public String buildMockArgsMatchers(List params,String language) { */ @NotNull private String deductMatcherTypeMethod(Param param, Language language) { - String matcherType; - if (param.getType().isVarargs()) { - matcherType = "anyVararg"; + Type type = param.getType(); + String matcherMethod = resolveMatcherMethod(type); + if (language == Language.Scala) { + return matcherMethod; } - else { - matcherType = TYPE_TO_ARG_MATCHERS.get(param.getType().getCanonicalName()); - } - if (matcherType == null) { - matcherType = "any"; + else if (!type.isPrimitive() && "any".equals(matcherMethod)) { + return matcherMethod + "("+ type.getCanonicalName()+(type.isArray()? "[]":"") +".class)"; + } else { + return matcherMethod+"()"; } - //todo support anyCollection(),anyMap(),anySet() and consider arrays - if (language != Language.Scala) { - matcherType += "()"; + } + + private static String resolveMatcherMethod(Type type) { + if (type.isVarargs()) { + return "anyVararg"; + } else if(!type.isArray() && TYPE_TO_ARG_MATCHERS.containsKey(type.getCanonicalName())){ + return TYPE_TO_ARG_MATCHERS.get(type.getCanonicalName()); + } else { + return "any"; } - return matcherType; } @SuppressWarnings("unused") @@ -262,8 +267,6 @@ private String deductMatcherTypeMethod(Param param, Language language) { public boolean shouldStub(Method testMethod, List testedClassFields) { return callsMockMethod(testMethod, testedClassFields, Method::hasReturn, null); } - - /** * true - if should stub tested method * @param testMethod method being tested diff --git a/testData/testMeAdditionalAction/innerStaticClassWithMember/test/com/example/services/impl/InnerStaticClassWithMemberTest.java b/testData/testMeAdditionalAction/innerStaticClassWithMember/test/com/example/services/impl/InnerStaticClassWithMemberTest.java index edcaa83a..326ccd4e 100644 --- a/testData/testMeAdditionalAction/innerStaticClassWithMember/test/com/example/services/impl/InnerStaticClassWithMemberTest.java +++ b/testData/testMeAdditionalAction/innerStaticClassWithMember/test/com/example/services/impl/InnerStaticClassWithMemberTest.java @@ -27,7 +27,7 @@ public void setUp() { @Test public void testMethodOfInnerClass() throws Exception { - when(innerFooFighter.fight(any())).thenReturn("fightResponse"); + when(innerFooFighter.fight(any(Fire.class))).thenReturn("fightResponse"); String result = innerStaticClassWithMember.methodOfInnerClass(new Fire()); Assert.assertEquals("replaceMeWithExpectedResult", result); diff --git a/testData/testMeGenerator/inheritance/test/com/example/services/impl/FooTest.java b/testData/testMeGenerator/inheritance/test/com/example/services/impl/FooTest.java index 8e0ea2c7..f1dab1c2 100644 --- a/testData/testMeGenerator/inheritance/test/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/inheritance/test/com/example/services/impl/FooTest.java @@ -25,7 +25,7 @@ public void setUp() { @Test public void testFight() throws Exception { - when(fooFighter.fight(any())).thenReturn("fightResponse"); + when(fooFighter.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse"); String result = foo.fight(new com.example.foes.Fire(), "foeName"); Assert.assertEquals("replaceMeWithExpectedResult", result); diff --git a/testData/testMeGenerator/inheritance/testGroovy/com/example/services/impl/FooTest.groovy b/testData/testMeGenerator/inheritance/testGroovy/com/example/services/impl/FooTest.groovy index 159bf082..813b36a8 100644 --- a/testData/testMeGenerator/inheritance/testGroovy/com/example/services/impl/FooTest.groovy +++ b/testData/testMeGenerator/inheritance/testGroovy/com/example/services/impl/FooTest.groovy @@ -23,7 +23,7 @@ class FooTest { @Test void testFight() { - when(fooFighter.fight(any())).thenReturn("fightResponse") + when(fooFighter.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse") java.lang.String result = foo.fight(new com.example.foes.Fire(), "foeName") assert result == "replaceMeWithExpectedResult" diff --git a/testData/testMeGenerator/inheritanceIgnored/test/com/example/services/impl/FooTest.java b/testData/testMeGenerator/inheritanceIgnored/test/com/example/services/impl/FooTest.java index df4c5cf8..042293f1 100644 --- a/testData/testMeGenerator/inheritanceIgnored/test/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/inheritanceIgnored/test/com/example/services/impl/FooTest.java @@ -25,7 +25,7 @@ public void setUp() { @Test public void testFight() throws Exception { - when(fooFighter.fight(any())).thenReturn("fightResponse"); + when(fooFighter.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse"); String result = foo.fight(new com.example.foes.Fire(), "foeName"); Assert.assertEquals("replaceMeWithExpectedResult", result); diff --git a/testData/testMeGenerator/inheritanceIgnored/testGroovy/com/example/services/impl/FooTest.groovy b/testData/testMeGenerator/inheritanceIgnored/testGroovy/com/example/services/impl/FooTest.groovy index 297957e9..4e7514ec 100644 --- a/testData/testMeGenerator/inheritanceIgnored/testGroovy/com/example/services/impl/FooTest.groovy +++ b/testData/testMeGenerator/inheritanceIgnored/testGroovy/com/example/services/impl/FooTest.groovy @@ -23,7 +23,7 @@ class FooTest { @Test void testFight() { - when(fooFighter.fight(any())).thenReturn("fightResponse") + when(fooFighter.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse") java.lang.String result = foo.fight(new com.example.foes.Fire(), "foeName") assert result == "replaceMeWithExpectedResult" diff --git a/testData/testMeGenerator/mockFieldsInDependencyInjection/test/com/example/services/impl/FooTest.java b/testData/testMeGenerator/mockFieldsInDependencyInjection/test/com/example/services/impl/FooTest.java index fd88aa53..8ae91316 100644 --- a/testData/testMeGenerator/mockFieldsInDependencyInjection/test/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/mockFieldsInDependencyInjection/test/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.TechFighter; import org.junit.Assert; import org.junit.Before; @@ -33,8 +35,8 @@ public void setUp() { @Test public void testFight() throws Exception { - when(techFighter.fight(any())).thenReturn("fightResponse"); - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse"); + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName"); diff --git a/testData/testMeGenerator/mockFieldsInDependencyInjection/testGroovy/com/example/services/impl/FooTest.groovy b/testData/testMeGenerator/mockFieldsInDependencyInjection/testGroovy/com/example/services/impl/FooTest.groovy index a8c52b38..fd764ef1 100644 --- a/testData/testMeGenerator/mockFieldsInDependencyInjection/testGroovy/com/example/services/impl/FooTest.groovy +++ b/testData/testMeGenerator/mockFieldsInDependencyInjection/testGroovy/com/example/services/impl/FooTest.groovy @@ -1,7 +1,9 @@ package com.example.services.impl import com.example.beans.ConvertedBean +import com.example.foes.Fear import com.example.foes.Fire +import com.example.foes.Ice import com.example.warriers.TechFighter import org.junit.Test import org.junit.Before @@ -29,8 +31,8 @@ class FooTest { @Test void testFight() { - when(techFighter.fight(any())).thenReturn("fightResponse") - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0)) + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse") + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0)) when(result.get()).thenReturn(0) String result = foo.fight(new Fire(), "foeName") diff --git a/testData/testMeGenerator/mockFieldsInDependencyInjection/testJunit5/com/example/services/impl/FooTest.java b/testData/testMeGenerator/mockFieldsInDependencyInjection/testJunit5/com/example/services/impl/FooTest.java index d66ace41..d11790a9 100644 --- a/testData/testMeGenerator/mockFieldsInDependencyInjection/testJunit5/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/mockFieldsInDependencyInjection/testJunit5/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.TechFighter; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; @@ -33,8 +35,8 @@ void setUp() { @Test void testFight() { - when(techFighter.fight(any())).thenReturn("fightResponse"); - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse"); + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName"); diff --git a/testData/testMeGenerator/mockFieldsInDependencyInjection/testPowerMock/com/example/services/impl/FooTest.java b/testData/testMeGenerator/mockFieldsInDependencyInjection/testPowerMock/com/example/services/impl/FooTest.java index c403a509..4ec047a0 100644 --- a/testData/testMeGenerator/mockFieldsInDependencyInjection/testPowerMock/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/mockFieldsInDependencyInjection/testPowerMock/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.TechFighter; import org.junit.Assert; import org.junit.Before; @@ -42,8 +44,8 @@ public void setUp() { @Test public void testFight() throws Exception { - when(techFighter.fight(any())).thenReturn("fightResponse"); - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse"); + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName"); verify(techFighter).initSelfArming(anyString()); diff --git a/testData/testMeGenerator/mockFieldsInDependencyInjection/testSpock/com/example/services/impl/FooTest.groovy b/testData/testMeGenerator/mockFieldsInDependencyInjection/testSpock/com/example/services/impl/FooTest.groovy index 71653bfd..6f83d057 100644 --- a/testData/testMeGenerator/mockFieldsInDependencyInjection/testSpock/com/example/services/impl/FooTest.groovy +++ b/testData/testMeGenerator/mockFieldsInDependencyInjection/testSpock/com/example/services/impl/FooTest.groovy @@ -1,7 +1,9 @@ package com.example.services.impl import com.example.beans.ConvertedBean +import com.example.foes.Fear import com.example.foes.Fire +import com.example.foes.Ice import com.example.warriers.TechFighter import spock.lang.* import org.mockito.InjectMocks @@ -27,8 +29,8 @@ class FooTest extends Specification { def "test fight"() { given: - when(techFighter.fight(any())).thenReturn("fightResponse") - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0)) + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse") + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0)) when(result.get()).thenReturn(0) when: diff --git a/testData/testMeGenerator/mockFieldsInDependencyInjection/testTestNg/com/example/services/impl/FooTest.java b/testData/testMeGenerator/mockFieldsInDependencyInjection/testTestNg/com/example/services/impl/FooTest.java index 9669ff74..c3b9f608 100644 --- a/testData/testMeGenerator/mockFieldsInDependencyInjection/testTestNg/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/mockFieldsInDependencyInjection/testTestNg/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.TechFighter; import org.mockito.InjectMocks; import org.mockito.Mock; @@ -33,8 +35,8 @@ public void setUp() { @Test public void testFight() { - when(techFighter.fight(any())).thenReturn("fightResponse"); - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse"); + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName"); diff --git a/testData/testMeGenerator/mockFieldsInDiWithCtor/test/com/example/services/impl/FooTest.java b/testData/testMeGenerator/mockFieldsInDiWithCtor/test/com/example/services/impl/FooTest.java index a3db85f5..544c9f83 100644 --- a/testData/testMeGenerator/mockFieldsInDiWithCtor/test/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/mockFieldsInDiWithCtor/test/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.TechFighter; import org.junit.Assert; import org.junit.Before; @@ -32,8 +34,8 @@ public void setUp() { @Test public void testFight() throws Exception { - when(techFighter.fight(any())).thenReturn("fightResponse"); - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse"); + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName"); diff --git a/testData/testMeGenerator/mockFieldsInDiWithCtor/testGroovy/com/example/services/impl/FooTest.groovy b/testData/testMeGenerator/mockFieldsInDiWithCtor/testGroovy/com/example/services/impl/FooTest.groovy index cd787760..5bc48044 100644 --- a/testData/testMeGenerator/mockFieldsInDiWithCtor/testGroovy/com/example/services/impl/FooTest.groovy +++ b/testData/testMeGenerator/mockFieldsInDiWithCtor/testGroovy/com/example/services/impl/FooTest.groovy @@ -1,7 +1,9 @@ package com.example.services.impl import com.example.beans.ConvertedBean +import com.example.foes.Fear import com.example.foes.Fire +import com.example.foes.Ice import com.example.warriers.TechFighter import org.junit.Test import org.junit.Before @@ -28,8 +30,8 @@ class FooTest { @Test void testFight() { - when(techFighter.fight(any())).thenReturn("fightResponse") - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0)) + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse") + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0)) when(result.get()).thenReturn(0) String result = foo.fight(new Fire(), "foeName") diff --git a/testData/testMeGenerator/mockFieldsInDiWithCtor/testJunit5/com/example/services/impl/FooTest.java b/testData/testMeGenerator/mockFieldsInDiWithCtor/testJunit5/com/example/services/impl/FooTest.java index 8d0c0725..dbbd5c07 100644 --- a/testData/testMeGenerator/mockFieldsInDiWithCtor/testJunit5/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/mockFieldsInDiWithCtor/testJunit5/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.TechFighter; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; @@ -32,8 +34,8 @@ void setUp() { @Test void testFight() { - when(techFighter.fight(any())).thenReturn("fightResponse"); - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse"); + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName"); diff --git a/testData/testMeGenerator/mockFieldsInDiWithCtor/testSpock/com/example/services/impl/FooTest.groovy b/testData/testMeGenerator/mockFieldsInDiWithCtor/testSpock/com/example/services/impl/FooTest.groovy index 62274d8e..6efaba8c 100644 --- a/testData/testMeGenerator/mockFieldsInDiWithCtor/testSpock/com/example/services/impl/FooTest.groovy +++ b/testData/testMeGenerator/mockFieldsInDiWithCtor/testSpock/com/example/services/impl/FooTest.groovy @@ -1,7 +1,9 @@ package com.example.services.impl import com.example.beans.ConvertedBean +import com.example.foes.Fear import com.example.foes.Fire +import com.example.foes.Ice import com.example.warriers.TechFighter import spock.lang.* import org.mockito.InjectMocks @@ -26,8 +28,8 @@ class FooTest extends Specification { def "test fight"() { given: - when(techFighter.fight(any())).thenReturn("fightResponse") - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0)) + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse") + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0)) when(result.get()).thenReturn(0) when: diff --git a/testData/testMeGenerator/mockFieldsInDiWithCtor/testTestNg/com/example/services/impl/FooTest.java b/testData/testMeGenerator/mockFieldsInDiWithCtor/testTestNg/com/example/services/impl/FooTest.java index 25c95234..bbee7002 100644 --- a/testData/testMeGenerator/mockFieldsInDiWithCtor/testTestNg/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/mockFieldsInDiWithCtor/testTestNg/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.TechFighter; import org.mockito.InjectMocks; import org.mockito.Mock; @@ -32,8 +34,8 @@ public void setUp() { @Test public void testFight() { - when(techFighter.fight(any())).thenReturn("fightResponse"); - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse"); + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName"); diff --git a/testData/testMeGenerator/mockFieldsInDiWithSetter/test/com/example/services/impl/FooTest.java b/testData/testMeGenerator/mockFieldsInDiWithSetter/test/com/example/services/impl/FooTest.java index fd88aa53..8ae91316 100644 --- a/testData/testMeGenerator/mockFieldsInDiWithSetter/test/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/mockFieldsInDiWithSetter/test/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.TechFighter; import org.junit.Assert; import org.junit.Before; @@ -33,8 +35,8 @@ public void setUp() { @Test public void testFight() throws Exception { - when(techFighter.fight(any())).thenReturn("fightResponse"); - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse"); + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName"); diff --git a/testData/testMeGenerator/mockFieldsInDiWithSetter/testGroovy/com/example/services/impl/FooTest.groovy b/testData/testMeGenerator/mockFieldsInDiWithSetter/testGroovy/com/example/services/impl/FooTest.groovy index a8c52b38..fd764ef1 100644 --- a/testData/testMeGenerator/mockFieldsInDiWithSetter/testGroovy/com/example/services/impl/FooTest.groovy +++ b/testData/testMeGenerator/mockFieldsInDiWithSetter/testGroovy/com/example/services/impl/FooTest.groovy @@ -1,7 +1,9 @@ package com.example.services.impl import com.example.beans.ConvertedBean +import com.example.foes.Fear import com.example.foes.Fire +import com.example.foes.Ice import com.example.warriers.TechFighter import org.junit.Test import org.junit.Before @@ -29,8 +31,8 @@ class FooTest { @Test void testFight() { - when(techFighter.fight(any())).thenReturn("fightResponse") - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0)) + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse") + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0)) when(result.get()).thenReturn(0) String result = foo.fight(new Fire(), "foeName") diff --git a/testData/testMeGenerator/mockFieldsInDiWithSetter/testJunit5/com/example/services/impl/FooTest.java b/testData/testMeGenerator/mockFieldsInDiWithSetter/testJunit5/com/example/services/impl/FooTest.java index d66ace41..d11790a9 100644 --- a/testData/testMeGenerator/mockFieldsInDiWithSetter/testJunit5/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/mockFieldsInDiWithSetter/testJunit5/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.TechFighter; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; @@ -33,8 +35,8 @@ void setUp() { @Test void testFight() { - when(techFighter.fight(any())).thenReturn("fightResponse"); - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse"); + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName"); diff --git a/testData/testMeGenerator/mockFieldsInDiWithSetter/testSpock/com/example/services/impl/FooTest.groovy b/testData/testMeGenerator/mockFieldsInDiWithSetter/testSpock/com/example/services/impl/FooTest.groovy index 71653bfd..6f83d057 100644 --- a/testData/testMeGenerator/mockFieldsInDiWithSetter/testSpock/com/example/services/impl/FooTest.groovy +++ b/testData/testMeGenerator/mockFieldsInDiWithSetter/testSpock/com/example/services/impl/FooTest.groovy @@ -1,7 +1,9 @@ package com.example.services.impl import com.example.beans.ConvertedBean +import com.example.foes.Fear import com.example.foes.Fire +import com.example.foes.Ice import com.example.warriers.TechFighter import spock.lang.* import org.mockito.InjectMocks @@ -27,8 +29,8 @@ class FooTest extends Specification { def "test fight"() { given: - when(techFighter.fight(any())).thenReturn("fightResponse") - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0)) + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse") + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0)) when(result.get()).thenReturn(0) when: diff --git a/testData/testMeGenerator/mockFieldsInDiWithSetter/testTestNg/com/example/services/impl/FooTest.java b/testData/testMeGenerator/mockFieldsInDiWithSetter/testTestNg/com/example/services/impl/FooTest.java index 9669ff74..c3b9f608 100644 --- a/testData/testMeGenerator/mockFieldsInDiWithSetter/testTestNg/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/mockFieldsInDiWithSetter/testTestNg/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.TechFighter; import org.mockito.InjectMocks; import org.mockito.Mock; @@ -33,8 +35,8 @@ public void setUp() { @Test public void testFight() { - when(techFighter.fight(any())).thenReturn("fightResponse"); - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse"); + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName"); diff --git a/testData/testMeGenerator/mockReturned/test/com/example/services/impl/FooTest.java b/testData/testMeGenerator/mockReturned/test/com/example/services/impl/FooTest.java index b639aab5..84ae0da5 100644 --- a/testData/testMeGenerator/mockReturned/test/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/mockReturned/test/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.FooFighter; import org.junit.Assert; import org.junit.Before; @@ -33,7 +35,7 @@ public void setUp() { @Test public void testFight() throws Exception { - when(fooFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(fooFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName"); diff --git a/testData/testMeGenerator/mockReturned/testGroovy/com/example/services/impl/FooTest.groovy b/testData/testMeGenerator/mockReturned/testGroovy/com/example/services/impl/FooTest.groovy index 1b1a3de2..134eb747 100644 --- a/testData/testMeGenerator/mockReturned/testGroovy/com/example/services/impl/FooTest.groovy +++ b/testData/testMeGenerator/mockReturned/testGroovy/com/example/services/impl/FooTest.groovy @@ -31,7 +31,7 @@ class FooTest { @Test void testFight() { - when(fooFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0, fear: new Fear(), ice: new Ice())) + when(fooFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0, fear: new Fear(), ice: new Ice())) when(result.get()).thenReturn(0) String result = foo.fight(new Fire(), "foeName") diff --git a/testData/testMeGenerator/mockReturned/testJunit5/com/example/services/impl/FooTest.java b/testData/testMeGenerator/mockReturned/testJunit5/com/example/services/impl/FooTest.java index 7c34f6b5..b4d8be20 100644 --- a/testData/testMeGenerator/mockReturned/testJunit5/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/mockReturned/testJunit5/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.FooFighter; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; @@ -33,7 +35,7 @@ void setUp() { @Test void testFight() { - when(fooFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(fooFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName"); diff --git a/testData/testMeGenerator/mockReturned/testSpock/com/example/services/impl/FooTest.groovy b/testData/testMeGenerator/mockReturned/testSpock/com/example/services/impl/FooTest.groovy index 8f0b5242..9da3c0b9 100644 --- a/testData/testMeGenerator/mockReturned/testSpock/com/example/services/impl/FooTest.groovy +++ b/testData/testMeGenerator/mockReturned/testSpock/com/example/services/impl/FooTest.groovy @@ -29,7 +29,7 @@ class FooTest extends Specification { def "test fight"() { given: - when(fooFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0, fear: new Fear(), ice: new Ice())) + when(fooFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0, fear: new Fear(), ice: new Ice())) when(result.get()).thenReturn(0) when: diff --git a/testData/testMeGenerator/mockReturned/testTestNg/com/example/services/impl/FooTest.java b/testData/testMeGenerator/mockReturned/testTestNg/com/example/services/impl/FooTest.java index cf2c559d..7288490a 100644 --- a/testData/testMeGenerator/mockReturned/testTestNg/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/mockReturned/testTestNg/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.FooFighter; import org.mockito.InjectMocks; import org.mockito.Mock; @@ -33,7 +35,7 @@ public void setUp() { @Test public void testFight() { - when(fooFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(fooFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName"); diff --git a/testData/testMeGenerator/paramsConstructors/test/com/example/services/impl/FooTest.java b/testData/testMeGenerator/paramsConstructors/test/com/example/services/impl/FooTest.java index 32aa422e..47815b8d 100644 --- a/testData/testMeGenerator/paramsConstructors/test/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/paramsConstructors/test/com/example/services/impl/FooTest.java @@ -37,7 +37,7 @@ public void setUp() { @Test public void testFight() throws Exception { - when(fooFighter.fight(any())).thenReturn("fightResponse"); + when(fooFighter.fight(any(Fire.class))).thenReturn("fightResponse"); BigBean result = foo.fight(new Fire(), List.of("foeName"), new BigBean(new DoneThat(0, "aDay", new Many("family", "members", "only"), new GregorianCalendar(2016, Calendar.JANUARY, 11, 22, 45).getTime(), null, "ifYourInDaHood"), new Many("family", "members", "only"), new DoneThat(0, "aDay", new Many("family", "members", "only"), new GregorianCalendar(2016, Calendar.JANUARY, 11, 22, 45).getTime(), null, "ifYourInDaHood")), new BeanThere(new DoneThat(0, "aDay", new Many("family", "members", "only"), new GregorianCalendar(2016, Calendar.JANUARY, 11, 22, 45).getTime(), new BigBean(null, new Many("family", "members", "only"), null), "ifYourInDaHood"), new Many("family", "members", "only"))); Assert.assertEquals(new BigBean(new DoneThat(0, "aDay", new Many("family", "members", "only"), new GregorianCalendar(2016, Calendar.JANUARY, 11, 22, 45).getTime(), null, "ifYourInDaHood"), new Many("family", "members", "only"), new DoneThat(0, "aDay", new Many("family", "members", "only"), new GregorianCalendar(2016, Calendar.JANUARY, 11, 22, 45).getTime(), null, "ifYourInDaHood")), result); diff --git a/testData/testMeGenerator/paramsConstructors/testGroovy/com/example/services/impl/FooTest.groovy b/testData/testMeGenerator/paramsConstructors/testGroovy/com/example/services/impl/FooTest.groovy index 51934713..df6dc6e3 100644 --- a/testData/testMeGenerator/paramsConstructors/testGroovy/com/example/services/impl/FooTest.groovy +++ b/testData/testMeGenerator/paramsConstructors/testGroovy/com/example/services/impl/FooTest.groovy @@ -29,7 +29,7 @@ class FooTest { @Test void testFight() { - when(fooFighter.fight(any())).thenReturn("fightResponse") + when(fooFighter.fight(any(Fire.class))).thenReturn("fightResponse") BigBean result = foo.fight(new Fire(), ["foeName"], new BigBean(new DoneThat(0, "aDay", new Many("family", "members", "only"), new GregorianCalendar(2016, Calendar.JANUARY, 11, 22, 45).getTime(), null, "ifYourInDaHood"), new Many("family", "members", "only"), new DoneThat(0, "aDay", new Many("family", "members", "only"), new GregorianCalendar(2016, Calendar.JANUARY, 11, 22, 45).getTime(), null, "ifYourInDaHood")), new BeanThere(new DoneThat(0, "aDay", new Many("family", "members", "only"), new GregorianCalendar(2016, Calendar.JANUARY, 11, 22, 45).getTime(), new BigBean(null, new Many("family", "members", "only"), null), "ifYourInDaHood"), new Many("family", "members", "only"))) assert result == new BigBean(new DoneThat(0, "aDay", new Many("family", "members", "only"), new GregorianCalendar(2016, Calendar.JANUARY, 11, 22, 45).getTime(), null, "ifYourInDaHood"), new Many("family", "members", "only"), new DoneThat(0, "aDay", new Many("family", "members", "only"), new GregorianCalendar(2016, Calendar.JANUARY, 11, 22, 45).getTime(), null, "ifYourInDaHood")) diff --git a/testData/testMeGenerator/renderInternalMethodCallStubs/testPowerMock/com/example/services/impl/FooTest.java b/testData/testMeGenerator/renderInternalMethodCallStubs/testPowerMock/com/example/services/impl/FooTest.java index e6c6746b..cee84562 100644 --- a/testData/testMeGenerator/renderInternalMethodCallStubs/testPowerMock/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/renderInternalMethodCallStubs/testPowerMock/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.TechFighter; import org.junit.Assert; import org.junit.Before; @@ -42,8 +44,8 @@ public void setUp() { @Test public void testFight() throws Exception { - when(techFighter.fight(any())).thenReturn("fightResponse"); - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse"); + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); Foo fooSpy = spy(foo); doReturn("thinkResponse").when(fooSpy, "think", anyString()); diff --git a/testData/testMeGenerator/renderInternalMethodCallStubsIgnored/testPowerMock/com/example/services/impl/FooTest.java b/testData/testMeGenerator/renderInternalMethodCallStubsIgnored/testPowerMock/com/example/services/impl/FooTest.java index c403a509..4ec047a0 100644 --- a/testData/testMeGenerator/renderInternalMethodCallStubsIgnored/testPowerMock/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/renderInternalMethodCallStubsIgnored/testPowerMock/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.TechFighter; import org.junit.Assert; import org.junit.Before; @@ -42,8 +44,8 @@ public void setUp() { @Test public void testFight() throws Exception { - when(techFighter.fight(any())).thenReturn("fightResponse"); - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse"); + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName"); verify(techFighter).initSelfArming(anyString()); diff --git a/testData/testMeGenerator/variousFieldTypes/test/com/example/services/impl/FooTest.java b/testData/testMeGenerator/variousFieldTypes/test/com/example/services/impl/FooTest.java index a8c9c531..c014c6cf 100644 --- a/testData/testMeGenerator/variousFieldTypes/test/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/variousFieldTypes/test/com/example/services/impl/FooTest.java @@ -45,12 +45,12 @@ public void setUp() { @Test public void testFight() throws Exception { - when(fooFighter.fight(any())).thenReturn("fightResponse"); - when(fooFighterProtected.fight(any())).thenReturn("fightResponse"); - when(fooFighterDefault.fight(any())).thenReturn("fightResponse"); - when(fooFighterPublic.fight(any())).thenReturn("fightResponse"); - when(fooFighterFinal.fight(any())).thenReturn("fightResponse"); - when(fooFighterStatic.fight(any())).thenReturn("fightResponse"); + when(fooFighter.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse"); + when(fooFighterProtected.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse"); + when(fooFighterDefault.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse"); + when(fooFighterPublic.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse"); + when(fooFighterFinal.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse"); + when(fooFighterStatic.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse"); when(innerOfPublicInnerClass.methodOfInnerClass()).thenReturn(new Foo().new PublicInnerClass().new InnerOfPublicInnerClass()); String result = foo.fight(new com.example.foes.Fire(), "foeName"); diff --git a/testData/testMeGenerator/variousFieldTypes/testGroovy/com/example/services/impl/FooTest.groovy b/testData/testMeGenerator/variousFieldTypes/testGroovy/com/example/services/impl/FooTest.groovy index 96e848e4..ab2d2e50 100644 --- a/testData/testMeGenerator/variousFieldTypes/testGroovy/com/example/services/impl/FooTest.groovy +++ b/testData/testMeGenerator/variousFieldTypes/testGroovy/com/example/services/impl/FooTest.groovy @@ -41,12 +41,12 @@ class FooTest { @Test void testFight() { - when(fooFighter.fight(any())).thenReturn("fightResponse") - when(fooFighterProtected.fight(any())).thenReturn("fightResponse") - when(fooFighterDefault.fight(any())).thenReturn("fightResponse") - when(fooFighterPublic.fight(any())).thenReturn("fightResponse") - when(fooFighterFinal.fight(any())).thenReturn("fightResponse") - when(fooFighterStatic.fight(any())).thenReturn("fightResponse") + when(fooFighter.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse") + when(fooFighterProtected.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse") + when(fooFighterDefault.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse") + when(fooFighterPublic.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse") + when(fooFighterFinal.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse") + when(fooFighterStatic.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse") when(innerOfPublicInnerClass.methodOfInnerClass()).thenReturn(new com.example.services.impl.Foo.PublicInnerClass.InnerOfPublicInnerClass(new com.example.services.impl.Foo.PublicInnerClass(new com.example.services.impl.Foo()))) java.lang.String result = foo.fight(new com.example.foes.Fire(), "foeName") diff --git a/testData/testMeGenerator/variousFieldTypes/testPowerMock/com/example/services/impl/FooTest.java b/testData/testMeGenerator/variousFieldTypes/testPowerMock/com/example/services/impl/FooTest.java index 6c7d2a40..d568d92f 100644 --- a/testData/testMeGenerator/variousFieldTypes/testPowerMock/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/variousFieldTypes/testPowerMock/com/example/services/impl/FooTest.java @@ -57,12 +57,12 @@ public void setUp() { @Test public void testFight() throws Exception { - when(fooFighter.fight(any())).thenReturn("fightResponse"); - when(fooFighterProtected.fight(any())).thenReturn("fightResponse"); - when(fooFighterDefault.fight(any())).thenReturn("fightResponse"); - when(fooFighterPublic.fight(any())).thenReturn("fightResponse"); - when(fooFighterFinal.fight(any())).thenReturn("fightResponse"); - when(fooFighterStatic.fight(any())).thenReturn("fightResponse"); + when(fooFighter.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse"); + when(fooFighterProtected.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse"); + when(fooFighterDefault.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse"); + when(fooFighterPublic.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse"); + when(fooFighterFinal.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse"); + when(fooFighterStatic.fight(any(com.example.foes.Fire.class))).thenReturn("fightResponse"); when(innerOfPublicInnerClass.methodOfInnerClass()).thenReturn(new Foo().new PublicInnerClass().new InnerOfPublicInnerClass()); String result = foo.fight(new com.example.foes.Fire(), "foeName"); verify(publicInnerClass).methodOfInnerClass(); diff --git a/testData/testMeGenerator/verifyMethodCall/test/com/example/services/impl/FooTest.java b/testData/testMeGenerator/verifyMethodCall/test/com/example/services/impl/FooTest.java index a3db85f5..544c9f83 100644 --- a/testData/testMeGenerator/verifyMethodCall/test/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/verifyMethodCall/test/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.TechFighter; import org.junit.Assert; import org.junit.Before; @@ -32,8 +34,8 @@ public void setUp() { @Test public void testFight() throws Exception { - when(techFighter.fight(any())).thenReturn("fightResponse"); - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse"); + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName"); diff --git a/testData/testMeGenerator/verifyMethodCall/testGroovy/com/example/services/impl/FooTest.groovy b/testData/testMeGenerator/verifyMethodCall/testGroovy/com/example/services/impl/FooTest.groovy index cd787760..5bc48044 100644 --- a/testData/testMeGenerator/verifyMethodCall/testGroovy/com/example/services/impl/FooTest.groovy +++ b/testData/testMeGenerator/verifyMethodCall/testGroovy/com/example/services/impl/FooTest.groovy @@ -1,7 +1,9 @@ package com.example.services.impl import com.example.beans.ConvertedBean +import com.example.foes.Fear import com.example.foes.Fire +import com.example.foes.Ice import com.example.warriers.TechFighter import org.junit.Test import org.junit.Before @@ -28,8 +30,8 @@ class FooTest { @Test void testFight() { - when(techFighter.fight(any())).thenReturn("fightResponse") - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0)) + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse") + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean(myString: "myString", someNum: 0)) when(result.get()).thenReturn(0) String result = foo.fight(new Fire(), "foeName") diff --git a/testData/testMeGenerator/verifyMethodCall/testJunit5/com/example/services/impl/FooTest.java b/testData/testMeGenerator/verifyMethodCall/testJunit5/com/example/services/impl/FooTest.java index 8d0c0725..dbbd5c07 100644 --- a/testData/testMeGenerator/verifyMethodCall/testJunit5/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/verifyMethodCall/testJunit5/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.TechFighter; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; @@ -32,8 +34,8 @@ void setUp() { @Test void testFight() { - when(techFighter.fight(any())).thenReturn("fightResponse"); - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse"); + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName"); diff --git a/testData/testMeGenerator/verifyMethodCall/testTestNg/com/example/services/impl/FooTest.java b/testData/testMeGenerator/verifyMethodCall/testTestNg/com/example/services/impl/FooTest.java index 25c95234..bbee7002 100644 --- a/testData/testMeGenerator/verifyMethodCall/testTestNg/com/example/services/impl/FooTest.java +++ b/testData/testMeGenerator/verifyMethodCall/testTestNg/com/example/services/impl/FooTest.java @@ -1,7 +1,9 @@ package com.example.services.impl; import com.example.beans.ConvertedBean; +import com.example.foes.Fear; import com.example.foes.Fire; +import com.example.foes.Ice; import com.example.warriers.TechFighter; import org.mockito.InjectMocks; import org.mockito.Mock; @@ -32,8 +34,8 @@ public void setUp() { @Test public void testFight() { - when(techFighter.fight(any())).thenReturn("fightResponse"); - when(techFighter.surrender(any(), any(), anyInt())).thenReturn(new ConvertedBean()); + when(techFighter.fight(any(Fire.class))).thenReturn("fightResponse"); + when(techFighter.surrender(any(Fear.class), any(Ice.class), anyInt())).thenReturn(new ConvertedBean()); when(result.get()).thenReturn(Integer.valueOf(0)); String result = foo.fight(new Fire(), "foeName");