1–DAYS ARRAY -
[0] 0 oldest day - DAY1
[1] 2 - DAY2
[2] 5 - DAY3
[3] 3 - DAY4
[4] 7 - DAY5
[5] 8 - DAY6
[6] 4 today
task 1 - PASS
task 2 - PASS
task 3 - FAIL
- When you use the “birdWatcher.getToday()” you referral to the last element (index 6) and you add one more day, so you go to the first element in the array (the DAY1) and the value is 0. In the comparison you get the value for index 6 and add 1 (TODAY + 1). It is wrong because you can’t use the value to calculate the index in the array.
The correct answer is ZERO
task 4 - PASS
task 4 - PASS
task 5 - PASS
task 5 - PASS
task 6 - PASS
task 6 - PASS
Actual code:
@Test
@Tag("task:3")
@DisplayName("The incrementTodaysCount method correctly increments today's counts")
public void itIncrementTodaysCount() {
birdWatcher.incrementTodaysCount();
assertThat(birdWatcher.getToday()).isEqualTo(TODAY + 1);
}
This is the correct code
@Test
@Tag("task:3")
@DisplayName("The incrementTodaysCount method correctly increments today's counts")
public void itIncrementTodaysCount() {
birdWatcher.incrementTodaysCount();
assertThat(birdWatcher.getToday()).isEqualTo(DAY1);
}
I try create a branch to submit the PR but was denied.
This is my suggest, I would like listen your opinion related on that.
Best regards,
Diego Umpierre