Skip to content

Commit

Permalink
previous next exercise coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
avalax committed Jan 12, 2018
1 parent 1b11ce8 commit 8b50710
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,15 @@ public boolean hasPreviousExercise(int exerciseIndex) {
if (!workoutSession.hasWorkout()) {
return false;
}
int size = workoutSession.getWorkout().getExercises().size();
return exerciseIndex > 0 && exerciseIndex < size;
return exerciseIndex > 0;
}

public boolean hasNextExercise(int exerciseIndex) {
if (!workoutSession.hasWorkout()) {
return false;
}
int size = workoutSession.getWorkout().getExercises().size();
return size > exerciseIndex + 1;
return exerciseIndex + 1 < size;
}

public boolean hasActiveWorkout() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,23 @@ public void setUp() throws Exception {
}

@Test
public void noActiveWorkout_shouldReturnFalse() throws Exception {
public void noActiveWorkout_shouldReturnIsNotActive() throws Exception {
when(workoutSession.hasWorkout()).thenReturn(false);
when(workoutSession.getWorkout()).thenReturn(null);

Assertions.assertThat(workoutService.isActiveWorkout(workout)).isFalse();
}

@Test
public void currentWorkoutIsActive_shouldReturnTrue() throws Exception {
public void currentWorkout_shouldReturnIsActive() throws Exception {
Assertions.assertThat(workoutService.isActiveWorkout(workout)).isTrue();
}

@Test
public void anotherWorkout_shouldReturnIsNotActive() throws Exception {
Assertions.assertThat(workoutService.isActiveWorkout(new BasicWorkout())).isFalse();
}

@Test
public void switchWorkout_shouldSetWorkout() throws Exception {
workoutService.switchWorkout(workout);
Expand Down

0 comments on commit 8b50710

Please sign in to comment.