Skip to content

Commit e89bcbf

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

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

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

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,7 @@ 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");
104-
}
105-
assertEquals(0, count, "Iterator should not traverse any items in an empty bag");
101+
org.junit.jupiter.api.Assertions.false(bag.iterator().hasNext(), "Iterator should not have any items for an empty bag");
106102
}
107103

108104
@Test

0 commit comments

Comments
 (0)