Skip to content

Commit 7980cd5

Browse files
author
Jegors Cemisovs
committed
Add test for hasDayWithoutBirds method
Added a test to validate the behavior of `hasDayWithoutBirds` when the last day has zero visits. Updated the `lastWeek` field to be final and align with best practices.
1 parent 85e54aa commit 7980cd5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

exercises/concept/bird-watcher/src/test/java/BirdWatcherTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class BirdWatcherTest {
1616
private static final int TODAY = 4;
1717

1818
private BirdWatcher birdWatcher;
19-
private int lastWeek[] = {DAY1, DAY2, DAY3, DAY4, DAY5, DAY6, TODAY};
19+
private final int[] lastWeek = {DAY1, DAY2, DAY3, DAY4, DAY5, DAY6, TODAY};
2020

2121
@BeforeEach
2222
public void setUp() {
@@ -61,6 +61,13 @@ public void itShouldNotHaveDaysWithoutBirds() {
6161
assertThat(birdWatcher.hasDayWithoutBirds()).isFalse();
6262
}
6363

64+
@Test
65+
@Tag("task:4")
66+
@DisplayName("The hasDayWithoutBirds method returns true if the last day has zero visits")
67+
public void itHasLastDayWithoutBirds() {
68+
birdWatcher = new BirdWatcher(new int[]{1, 2, 5, 3, 7, 8, 0});
69+
assertThat(birdWatcher.hasDayWithoutBirds()).isTrue();
70+
}
6471

6572
@Test
6673
@Tag("task:5")

0 commit comments

Comments
 (0)