Solving an assignment twice adds its again which breaks the UI because the endpoint for lessonoverview returns mulitple values for the same assignment.
This commit is contained in:
@ -70,5 +70,18 @@ public class LessonTrackerTest {
|
||||
assertThat(lessonOverview.get(a2)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void solvingSameAssignmentShouldNotAddItTwice() {
|
||||
AbstractLesson lesson = mock(AbstractLesson.class);
|
||||
Assignment a1 = new Assignment("a1", "a1");
|
||||
List<Assignment> assignments = Lists.newArrayList(a1);
|
||||
when(lesson.getAssignments()).thenReturn(assignments);
|
||||
LessonTracker lessonTracker = new LessonTracker(lesson);
|
||||
lessonTracker.assignmentSolved("a1");
|
||||
lessonTracker.assignmentSolved("a1");
|
||||
|
||||
assertThat(lessonTracker.getLessonOverview().size()).isEqualTo(1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user