package testcode; import static org.junit.Assert.assertTrue; import java.io.IOException; import java.util.Arrays; import java.util.Collection; import org.eclipse.jdt.annotation.NonNull; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; /** * Test to see if getResource can reach the resource file. */ @RunWith(Parameterized.class) public class ParameterizedTest { @Parameters public static @NonNull Collection<@NonNull Object[]> data() { return Arrays.asList(new Object[][] { { "ok1" }, { "ok2" } }); } private final @NonNull String val; public ParameterizedTest(@NonNull String val) { this.val = val; } @Test public void test1() throws IOException { // would be nice if we can check this is called exactly 2 times assertTrue(val.startsWith("ok")); } @Test public void test_more() throws IOException { assertTrue(val.endsWith("1") | val.endsWith("2")); } }