-
-
Notifications
You must be signed in to change notification settings - Fork 691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding analyzer feedback to design.md for bird watcher concept exercise #2695
Adding analyzer feedback to design.md for bird watcher concept exercise #2695
Conversation
I have a couple of doubts on the reference resolution:
The clone in the method
Also I was thinking that this could be simplified to public void incrementTodaysCount() {
birdsPerDay[birdsPerDay.length - 1]++;
} But this one is more peaky. |
I think the author added the birdWatcher.getLastWeek()[0] = 0; Adding the
Yeah I think you're right. The exercise's |
Reading the exercise instructions again, I think that the implementation of
From this I conclude that the solution must always return those values. The array passed to the constructor contains the values for this week, not last week. So the exemplar solution should implement |
Adding celebratory comment Updating analyzer comments to require the user to implement a for and for-each loop Updating reference resolution
@@ -7,15 +7,15 @@ public BirdWatcher(int[] birdsPerDay) { | |||
} | |||
|
|||
public int[] getLastWeek() { | |||
return birdsPerDay.clone(); | |||
return new int[] { 0, 2, 5, 3, 7, 8, 4 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 interesting that the tests don't fail after this change. Makes me wonder whether the test suite is complete... But, I guess that is out of scope for this PR. Might be worth looking into in a separate issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should the test cases fail?(Can you please elaborate a little bit)
The array which getLastWeek() is returning is the same array which is being passed while creating the object of Birdwatcher.
`
private static final int DAY1 = 0;
private static final int DAY2 = 2;
private static final int DAY3 = 5;
private static final int DAY4 = 3;
private static final int DAY5 = 7;
private static final int DAY6 = 8;
private static final int TODAY = 4;
private BirdWatcher birdWatcher;
private int lastWeek[] = {DAY1, DAY2, DAY3, DAY4, DAY5, DAY6, TODAY};
@BeforeEach
public void setUp() {
birdWatcher = new BirdWatcher(lastWeek);
}
@Test
@Tag("task:1")
@DisplayName("The getLastWeek method correctly returns last week's counts")
public void itTestGetLastWeek() {
assertThat(birdWatcher.getLastWeek())
.containsExactly(DAY1, DAY2, DAY3, DAY4, DAY5, DAY6, TODAY);
}
`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @phoenix-1729 I recommend to ask the questions in the issue itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pull request
Related issue: #2670
Reviewer Resources:
Track Policies