Skip to content

Commit b84e962

Browse files
committed
Update EmptyIteratorTest.java
1 parent d1d6496 commit b84e962

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

microsphere-java-core/src/test/java/io/microsphere/collection/EmptyIteratorTest.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package io.microsphere.collection;
22

3+
import org.junit.jupiter.api.BeforeEach;
34
import org.junit.jupiter.api.Test;
45

56
import java.util.NoSuchElementException;
67

7-
import static io.microsphere.collection.EmptyIterator.INSTANCE;
88
import static org.junit.jupiter.api.Assertions.assertFalse;
99
import static org.junit.jupiter.api.Assertions.assertThrows;
1010

@@ -17,18 +17,25 @@
1717
*/
1818
public class EmptyIteratorTest {
1919

20+
private EmptyIterator emptyIterator;
21+
22+
@BeforeEach
23+
public void before() {
24+
emptyIterator = new EmptyIterator();
25+
}
26+
2027
@Test
2128
public void testHasNext() {
22-
assertFalse(INSTANCE.hasNext());
29+
assertFalse(emptyIterator.hasNext());
2330
}
2431

2532
@Test
2633
public void testNext() {
27-
assertThrows(NoSuchElementException.class, INSTANCE::next);
34+
assertThrows(NoSuchElementException.class, emptyIterator::next);
2835
}
2936

3037
@Test
3138
public void testRemove() {
32-
assertThrows(IllegalStateException.class, INSTANCE::remove);
39+
assertThrows(IllegalStateException.class, emptyIterator::remove);
3340
}
3441
}

0 commit comments

Comments
 (0)