-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtilityTest.java
More file actions
32 lines (26 loc) · 855 Bytes
/
UtilityTest.java
File metadata and controls
32 lines (26 loc) · 855 Bytes
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
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import java.util.Arrays;
import java.util.List;
class UtilityTest {
@Test
void dayOfYear() {
assertEquals(31, Utility.dayOfYear(1, 31, 2022));
assertEquals(59, Utility.dayOfYear(2, 28, 2022));
assertEquals(90, Utility.dayOfYear(3, 31, 2022));
}
@Test
void leap() {
assertTrue(Utility.leap(2020));
assertFalse(Utility.leap(2021));
assertFalse(Utility.leap(1900));
assertTrue(Utility.leap(2000));
}
@Test
void countLongWords() {
List<String> words = Arrays.asList("apple", "banana", "kiwi", "strawberry", "grape");
Utility.countLongWords(words);
assertEquals(10, Utility.LONG_WORD_LENGTH);
assertEquals("strawberry", Utility.longestWord);
}
}