forked from mockito/mockito
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
...internal/configuration/injection/InjectionFourHashmapsWithDifferentTypeParameterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package org.mockito.internal.configuration.injection; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.MockitoJUnitRunner; | ||
|
||
import java.util.HashMap; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
@RunWith(MockitoJUnitRunner.class) | ||
public class InjectionFourHashmapsWithDifferentTypeParameterTest { | ||
public static class TwoListsTest { | ||
private final HashMap<String, String> hashmap1; | ||
private final HashMap<String, Integer> hashmap2; | ||
private final HashMap<Float, Integer> hashmap3; | ||
private final HashMap<Float, Float> hashmap4; | ||
|
||
public TwoListsTest( | ||
HashMap<String, String> hashmap1, HashMap<String, Integer> hashmap2, HashMap<Float, Integer> hashmap3, HashMap<Float, Float> hashmap4) { | ||
this.hashmap1 = hashmap1; | ||
this.hashmap2 = hashmap2; | ||
this.hashmap3 = hashmap3; | ||
this.hashmap4 = hashmap4; | ||
} | ||
|
||
public HashMap<String, String> getHashmap1() { | ||
return hashmap1; | ||
} | ||
|
||
public HashMap<String, Integer> getHashmap2() { | ||
return hashmap2; | ||
} | ||
|
||
public HashMap<Float, Integer> getHashmap3() { | ||
return hashmap3; | ||
} | ||
|
||
public HashMap<Float, Float> getHashmap4() { | ||
return hashmap4; | ||
} | ||
} | ||
|
||
@Mock(strictness = Mock.Strictness.LENIENT) | ||
HashMap<String, String> mockhashmap1; | ||
|
||
@Mock(strictness = Mock.Strictness.LENIENT) | ||
HashMap<String, Integer> mockhashmap2; | ||
|
||
@Mock(strictness = Mock.Strictness.LENIENT) | ||
HashMap<Float, Float> mockhashmap4; | ||
@Mock(strictness = Mock.Strictness.LENIENT) | ||
HashMap<Float, Integer> mockhashmap3; | ||
|
||
@InjectMocks | ||
TwoListsTest productionClass; | ||
@Test | ||
public void test() { | ||
assertEquals("mockhashmap1", productionClass.getHashmap1().toString()); | ||
assertEquals("mockhashmap2", productionClass.getHashmap2().toString()); | ||
assertEquals("mockhashmap3", productionClass.getHashmap3().toString()); | ||
assertEquals("mockhashmap4", productionClass.getHashmap4().toString()); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...ito/internal/configuration/injection/InjectionTwoListsWithDifferentTypeParameterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.mockito.internal.configuration.injection; | ||
|
||
import static org.junit.Assert.*; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.MockitoJUnitRunner; | ||
|
||
import java.util.List; | ||
|
||
@RunWith(MockitoJUnitRunner.class) | ||
public class InjectionTwoListsWithDifferentTypeParameterTest { | ||
public static class TwoListsTest { | ||
private final List<Integer> integerList; | ||
private final List<String> stringList; | ||
|
||
TwoListsTest(List<String> argumentStringList, List<Integer> argumentIntegerList) { | ||
this.stringList = argumentStringList; | ||
this.integerList = argumentIntegerList; | ||
} | ||
|
||
public List<Integer> getIntegerList() { | ||
return integerList; | ||
} | ||
|
||
public List<String> getStringList() { | ||
return stringList; | ||
} | ||
} | ||
@InjectMocks | ||
TwoListsTest productionClass; | ||
|
||
@Mock(strictness = Mock.Strictness.LENIENT) | ||
List<Integer> mockIntegerList; | ||
|
||
@Mock(strictness = Mock.Strictness.LENIENT) | ||
List<String> mockStringList; | ||
@Test | ||
public void test() { | ||
System.out.println(productionClass.getIntegerList()); | ||
System.out.println(productionClass.getStringList()); | ||
assertEquals("mockIntegerList", productionClass.getIntegerList().toString()); | ||
assertEquals("mockStringList", productionClass.getStringList().toString()); | ||
} | ||
} |