-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathTestMyDateMethodIsLeapYear.java
More file actions
49 lines (38 loc) · 1.07 KB
/
TestMyDateMethodIsLeapYear.java
File metadata and controls
49 lines (38 loc) · 1.07 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
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 TestMyDateMethodIsLeapYear {
@Parameters(name = "{index}: isLeapYear({0}) = {1}")
public static Iterable<Object[]> data() {
return Arrays.asList(new Object[][] {
{ 2012, true }
, { 1600, true }
, { 1900, false }
, { 2014, false }
, { 2000, true }
, { 1700, false }
});
}
private int input;
private boolean expected;
public TestMyDateMethodIsLeapYear(int input, boolean expected) {
this.input = input;
this.expected = expected;
}
@Test
public void isLeapYearTest() {
org.junit.Assert.assertEquals(expected, MyDate.isLeapYear(input));
}
}