1+ import org .junit .jupiter .api .BeforeEach ;
12import org .junit .jupiter .api .DisplayName ;
23import org .junit .jupiter .api .Tag ;
34import org .junit .jupiter .api .Test ;
4- import org .junit .jupiter .api .BeforeEach ;
55
6- import static org .assertj .core .api .Assertions .* ;
6+ import static org .assertj .core .api .Assertions .assertThat ;
77
88public class BirdWatcherTest {
99
10- private static final int DAY1 = 0 ;
11- private static final int DAY2 = 2 ;
12- private static final int DAY3 = 5 ;
13- private static final int DAY4 = 3 ;
14- private static final int DAY5 = 7 ;
15- private static final int DAY6 = 8 ;
16- private static final int TODAY = 4 ;
10+ private static final int DAY1 = 7 ;
11+ private static final int DAY2 = 0 ;
12+ private static final int DAY3 = 4 ;
13+ private static final int DAY4 = 8 ;
14+ private static final int DAY5 = 5 ;
15+ private static final int DAY6 = 2 ;
16+ private static final int TODAY = 3 ;
1717
1818 private BirdWatcher birdWatcher ;
19- private final int [] lastWeek = {DAY1 , DAY2 , DAY3 , DAY4 , DAY5 , DAY6 , TODAY };
19+ private final int [] currentWeek = {DAY1 , DAY2 , DAY3 , DAY4 , DAY5 , DAY6 , TODAY };
20+ private final int [] lastWeek = {0 , 2 , 5 , 3 , 7 , 8 , 4 };
2021
2122 @ BeforeEach
2223 public void setUp () {
23- birdWatcher = new BirdWatcher (lastWeek );
24+ birdWatcher = new BirdWatcher (currentWeek );
2425 }
2526
2627 @ Test
2728 @ Tag ("task:1" )
2829 @ DisplayName ("The getLastWeek method correctly returns last week's counts" )
2930 public void itTestGetLastWeek () {
3031 assertThat (birdWatcher .getLastWeek ())
31- .containsExactly ( DAY1 , DAY2 , DAY3 , DAY4 , DAY5 , DAY6 , TODAY );
32+ .isEqualTo ( lastWeek );
3233 }
3334
3435 @ Test
@@ -42,13 +43,16 @@ public void itTestGetToday() {
4243 @ Tag ("task:3" )
4344 @ DisplayName ("The incrementTodaysCount method correctly increments today's counts" )
4445 public void itIncrementTodaysCount () {
46+ int firstSixDaysBeforeIncrement = birdWatcher .getCountForFirstDays (6 );
4547 birdWatcher .incrementTodaysCount ();
48+ int firstSixDaysAfterIncrement = birdWatcher .getCountForFirstDays (6 );
4649 assertThat (birdWatcher .getToday ()).isEqualTo (TODAY + 1 );
50+ assertThat (firstSixDaysAfterIncrement ).isEqualTo (firstSixDaysBeforeIncrement );
4751 }
4852
4953 @ Test
5054 @ Tag ("task:4" )
51- @ DisplayName ("The hasDayWithoutBirds method returns true when day had no visits" )
55+ @ DisplayName ("The hasDayWithoutBirds method returns true when at least one day had no visits" )
5256 public void itHasDayWithoutBirds () {
5357 assertThat (birdWatcher .hasDayWithoutBirds ()).isTrue ();
5458 }
@@ -88,7 +92,7 @@ public void itTestGetCountForMoreDaysThanTheArraySize() {
8892 @ Tag ("task:6" )
8993 @ DisplayName ("The getBusyDays method returns the correct count of busy days" )
9094 public void itTestGetCountForBusyDays () {
91- // DAY3, DAY5 and DAY6 are all >= 5 birds
95+ // DAY1, DAY4 and DAY5 are all >= 5 birds
9296 assertThat (birdWatcher .getBusyDays ()).isEqualTo (3 );
9397 }
9498
0 commit comments