forked from java-tester-x/JavaExercises4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestMyDateMethodNextYear.java
More file actions
50 lines (39 loc) · 1.36 KB
/
TestMyDateMethodNextYear.java
File metadata and controls
50 lines (39 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package test;
import java.util.*;
import org.junit.Test;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import src.MyDate;
/**
* Tests for {@link src/MyDate.java}.
*
* @author java-tester-x
*/
@RunWith(Parameterized.class)
public class TestMyDateMethodNextYear {
@Parameters(name = "{index}: nextYear({0}) = {1}")
public static Iterable<Object[]> data() {
return Arrays.asList(new Object[][] {
{ new MyDate(2013, 12, 31), new MyDate(2014, 12, 31) }
, { new MyDate(2012, 2, 28), new MyDate(2013, 2, 28) }
, { new MyDate(2012, 2, 29), new MyDate(2013, 2, 28) }
, { new MyDate(2011, 2, 28), new MyDate(2012, 2, 29) }
, { new MyDate(2014, 5, 31), new MyDate(2015, 5, 31) }
, { new MyDate(2014, 7, 4), new MyDate(2015, 7, 4) }
, { new MyDate(2014, 6, 30), new MyDate(2015, 6, 30) }
});
}
private MyDate input;
private MyDate expected;
public TestMyDateMethodNextYear(MyDate input, MyDate expected) {
this.input = input;
this.expected = expected;
}
@Test
public void nextYearTest() {
org.junit.Assert.assertEquals(expected, input.nextYear());
}
}