Created
June 1, 2017 06:59
-
-
Save woprzech/1eb5dc8169d61c4e651a276b8acdb718 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GradesServiceTest { | |
private Student student; | |
private Gradebook gradebook; | |
@Before | |
public void setUp() throws Exception { | |
gradebook = mock(Gradebook.class); | |
student = new Student(); | |
} | |
@Test | |
public void calculates_grades_average_for_student() { | |
when(gradebook.gradesFor(student)).thenReturn(grades(8, 6, 10)); //stubbing gradebook | |
double averageGrades = new GradesService(gradebook).averageGrades(student); | |
assertThat(averageGrades).isEqualTo(8.0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment