We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
DLS_DEAD_LOCAL_STORE
testIteratorEmptyBag
1 parent f8232c7 commit de9acb3Copy full SHA for de9acb3
1 file changed
src/test/java/com/thealgorithms/datastructures/bag/BagTest.java
@@ -98,11 +98,9 @@ void testIterator() {
98
@Test
99
void testIteratorEmptyBag() {
100
Bag<String> bag = new Bag<>();
101
- int count = 0;
102
- for (String ignored : bag) {
103
- org.junit.jupiter.api.Assertions.fail("Iterator should not return any items for an empty bag");
+ for (String item : bag) {
+ org.junit.jupiter.api.Assertions.fail("Iterator returned item for an empty bag:" + item);
104
}
105
- assertEquals(0, count, "Iterator should not traverse any items in an empty bag");
106
107
108
0 commit comments