You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Test
public void exerciseCanBeMarkedAsCompleted() {
management.add("New exercise");
management.markAsCompleted("New exercise");
assertTrue(management.isCompleted("New exercise"));
//this test fails because of the add method not correctly addeding im assumeing the beleow test doesnn't work as intened as well.
// ill try to fix it and understand it sometime later. I spent too long loocking into it right now
}
The reason it doesn't work is because in Exercise class, the method
public void setCompleted(boolean completed) {
completed = completed;
}
It has to code like this, where this.completed = completed;
public void setCompleted(boolean completed) {
this.completed = completed;
}
It's because the parameter is named completed, so you have to use this.completed to specify your boolean value. Then the bug is fixed.
The text was updated successfully, but these errors were encountered:
In ExerciseManagementTest.java,
you commented:
The reason it doesn't work is because in
Exercise
class, the methodIt has to code like this, where
this.completed = completed;
It's because the parameter is named
completed
, so you have to use this.completed to specify your boolean value. Then the bug is fixed.The text was updated successfully, but these errors were encountered: