@Test
@Tag("task:4")
@DisplayName("The hasDayWithoutBirds method returns true if the last day has zero visits")
public void itHasLastDayWithoutBirds() {
birdWatcher = new BirdWatcher(new int[]{1, 2, 5, 3, 7, 8, 0});
assertThat(birdWatcher.hasDayWithoutBirds()).isTrue();
}
I explained to the students that this was an error in the code logic. The solution passes all the test cases. Perhaps we could add a test case to the problem specifications?
Itās a concept exercise, not a practice exercise, so the test cases are specific to the Java track implementation. Iām not a Java track maintainer, but theyāre fairly active so Iām sure youāll get feedback soon enough.
Iām hesitant to add this one at the moment. There are already 11,976 completed solutions for this one that would we would need to retest if we add this test case.
Since this cover the arrays concept, learning to iterate over the entire array seems reasonable to me. However, tasks 5 and 6 also cover iterating over the array correctly. I donāt think we need to cover this off by one case on all of the three tasks (assuming they used the same way to iterate for all three tasks).
Although it hasnāt been implemented yet, I think the analyzer could check for this. Happy to add it the list of things that analyzer could look for in its design.md.
Community solutions for Bird Watcher in Java on Exercism has two pages of solutions that reference birdsPerDay.length but that might be used elsewhere in the solution. So weāre looking at a theoretical max of 2.6k solutions (48 search results times 56 grouped solutions for the most submitted one), but the number affected is likely much lower. The first ten I checked donāt use a for loop inside this method so the proposed tests should almost certainly pass. The grouped solutions counts drop into the tens of solutions after this point so Iām thinking this might not be a common issue.