source: java2python/junit-t/parameterizedtest/testcode/ParameterizedTest.java@ 1111

Last change on this file since 1111 was 904, checked in by wouter, 4 months ago

parameterized run now works

File size: 988 bytes
RevLine 
[904]1package testcode;
2
3import static org.junit.Assert.assertTrue;
4
5import java.io.IOException;
6import java.util.Arrays;
7import java.util.Collection;
8
9import org.eclipse.jdt.annotation.NonNull;
10import org.junit.Test;
11import org.junit.runner.RunWith;
12import org.junit.runners.Parameterized;
13import org.junit.runners.Parameterized.Parameters;
14
15/**
16 * Test to see if getResource can reach the resource file.
17 */
18@RunWith(Parameterized.class)
19public class ParameterizedTest {
20
21 @Parameters
22 public static @NonNull Collection<@NonNull Object[]> data() {
23 return Arrays.asList(new Object[][] { { "ok1" }, { "ok2" } });
24 }
25
26 private final @NonNull String val;
27
28 public ParameterizedTest(@NonNull String val) {
29 this.val = val;
30 }
31
32 @Test
33 public void test1() throws IOException {
34 // would be nice if we can check this is called exactly 2 times
35 assertTrue(val.startsWith("ok"));
36 }
37
38 @Test
39 public void test_more() throws IOException {
40 assertTrue(val.endsWith("1") | val.endsWith("2"));
41 }
42
43}
Note: See TracBrowser for help on using the repository browser.