forked from java-tester-x/JavaExercises4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestMyDateMethodPreviousDay.java
More file actions
58 lines (47 loc) · 1.92 KB
/
TestMyDateMethodPreviousDay.java
File metadata and controls
58 lines (47 loc) · 1.92 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
51
52
53
54
55
56
57
58
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 TestMyDateMethodPreviousDay {
@Parameters(name = "{index}: previousDay({0}) = {1}")
public static Iterable<Object[]> data() {
return Arrays.asList(new Object[][] {
{ new MyDate(2014, 1, 1), new MyDate(2013, 12, 31) }
, { new MyDate(2012, 2, 29), new MyDate(2012, 2, 28) }
, { new MyDate(2012, 3, 1), new MyDate(2012, 2, 29) }
, { new MyDate(2014, 6, 1), new MyDate(2014, 5, 31) }
, { new MyDate(2014, 7, 5), new MyDate(2014, 7, 4) }
, { new MyDate(2014, 7, 1), new MyDate(2014, 6, 30) }
, { new MyDate(2014, 12, 1), new MyDate(2014, 11, 30) }
, { new MyDate(2014, 3, 1), new MyDate(2014, 2, 28) }
, { new MyDate(2014, 6, 1), new MyDate(2014, 5, 31) }
, { new MyDate(2014, 7, 1), new MyDate(2014, 6, 30) }
, { new MyDate(2014, 8, 1), new MyDate(2014, 7, 31) }
, { new MyDate(2014, 9, 1), new MyDate(2014, 8, 31) }
, { new MyDate(2014, 10, 1), new MyDate(2014, 9, 30) }
, { new MyDate(2014, 11, 1), new MyDate(2014, 10, 31) }
, { new MyDate(2014, 12, 1), new MyDate(2014, 11, 30) }
});
}
private MyDate input;
private MyDate expected;
public TestMyDateMethodPreviousDay(MyDate input, MyDate expected) {
this.input = input;
this.expected = expected;
}
@Test
public void previousDayTest() {
org.junit.Assert.assertEquals(expected, input.previousDay());
}
}