This file contains hidden or 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
| public class InfinispanContainer extends GenericContainer<InfinispanContainer> { | |
| private static final String IMAGE_NAME = "jboss/infinispan-server"; | |
| public InfinispanContainer() { | |
| this(IMAGE_NAME + ":latest"); | |
| } | |
| public InfinispanContainer(final String imageName) { | |
| super(imageName); |
This file contains hidden or 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
| @ClassRule | |
| public static InfinispanContainer infinispan = new InfinispanContainer(); |
This file contains hidden or 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
| cacheManager.administration().createCache("someCache", null); |
This file contains hidden or 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
| // ... | |
| private RemoteCacheManager cacheManager; | |
| private Collection<String> cacheNames; | |
| // ... | |
| public InfinispanContainer withCaches(final Collection<String> cacheNames) { | |
| this.cacheNames = cacheNames; | |
| return this; | |
| } |
This file contains hidden or 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
| @ClassRule | |
| public static InfinispanContainer infinispan = | |
| new InfinispanContainer() | |
| .withProtocolVersion(ProtocolVersion.PROTOCOL_VERSION_21) | |
| .withCaches("testCache"); | |
| @Test | |
| public void should_get_existing_cache() { | |
| assertNotNull(infinispan.getCacheManager().getCache("testCache")); | |
| } |
This file contains hidden or 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
| public class FibonacciTest { | |
| @Parameters | |
| public static Collection<object[]> data() { | |
| return Arrays.asList(new Object[][] { | |
| {0,0},{1,1},{2,1},{3,2} })}; | |
| private int input, expected; | |
| public FibonacciTest(int input, int expected) { |
This file contains hidden or 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
| @RunWith(JUnitParamsRunner.class) | |
| public class PersonTest { | |
| @Test | |
| @Parameters({"0, 0", "1, 1", "2, 1", "3, 2" }) | |
| public void personIsAdult(int input, int expected) { | |
| assertEquals(expected, Fibonacci.compute(input)); | |
| } | |
| } |
This file contains hidden or 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
| class DynamicTests { | |
| @TestFactory | |
| List createSomeTests() { | |
| return Arrays.asList( | |
| DynamicTest.dynamicTest("First dynamically created test", | |
| () -> assertTrue(true)), | |
| DynamicTest.dynamicTest("Second dynamically created test", |
This file contains hidden or 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
| class ParameterizedTests { | |
| @ParameterizedTest | |
| @ValueSource(ints = {1,2,3,4,5}) | |
| void valueSourceTest(int param){ | |
| // ... | |
| } | |
| } |
This file contains hidden or 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
| @ArgumentsSource(JsonArgumentsProvider.class) | |
| public @interface JsonSource { | |
| String[] value(); | |
| Class<?> type(); | |
| } |