Skip to content

Commit de9acb3

Browse files
committed
style: resolve DLS_DEAD_LOCAL_STORE in testIteratorEmptyBag
1 parent f8232c7 commit de9acb3

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

  • src/test/java/com/thealgorithms/datastructures/bag

src/test/java/com/thealgorithms/datastructures/bag/BagTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,9 @@ void testIterator() {
9898
@Test
9999
void testIteratorEmptyBag() {
100100
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");
101+
for (String item : bag) {
102+
org.junit.jupiter.api.Assertions.fail("Iterator returned item for an empty bag:" + item);
104103
}
105-
assertEquals(0, count, "Iterator should not traverse any items in an empty bag");
106104
}
107105

108106
@Test

0 commit comments

Comments
 (0)