Skip to content

Commit b47805e

Browse files
authored
Merge pull request exercism#390 from superklamer/grade-school
grade-school: remove potential test pollution [Fix exercism#371]
2 parents 6203367 + c4add55 commit b47805e

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎exercises/grade-school/src/test/java/SchoolTest.java‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import org.junit.Before;
12
import org.junit.Ignore;
23
import org.junit.Test;
34

@@ -15,7 +16,12 @@
1516
import static org.junit.Assert.assertEquals;
1617

1718
public class SchoolTest {
18-
private final School school = new School();
19+
private School school;
20+
21+
@Before
22+
public void setUp() {
23+
school = new School();
24+
}
1925

2026
@Test
2127
public void startsWithNoStudents() {
@@ -120,7 +126,7 @@ public void modifyingSortedStudentsShouldNotModifyInternalDatabase() {
120126
// Such as UnsupportedOperationException when an unmodifiableMap is used
121127
}
122128

123-
assertThat(school.studentsByGradeAlphabetical().get(grade),
129+
assertThat(school.studentsByGradeAlphabetical().get(grade),
124130
not(hasItem(studentWhichShouldNotBeAdded)));
125131
}
126132
}

0 commit comments

Comments
 (0)