This commit is related to the article BAEL-7089 (#15065)

This commit aims to update the evenElementsQueue queue with oddElementsQueue.
This commit is contained in:
Mo Helmy
2023-10-25 19:10:28 +03:00
committed by GitHub
parent 6807803bd3
commit 69aaf2dbf7
@@ -12,7 +12,7 @@ public class RemoveQueueElementsUnitTest {
@Test
public void givenQueueWithEvenAndOddNumbers_whenRemovingEvenNumbers_thenOddNumbersRemain() {
Queue<Integer> queue = new LinkedList<>();
Queue<Integer> evenElementsQueue = new LinkedList<>();
Queue<Integer> oddElementsQueue = new LinkedList<>();
queue.add(1);
queue.add(2);
queue.add(3);
@@ -22,14 +22,14 @@ public class RemoveQueueElementsUnitTest {
while (queue.peek() != null) {
int element = queue.remove();
if (element % 2 != 0) {
evenElementsQueue.add(element);
oddElementsQueue.add(element);
}
}
assertEquals(3, evenElementsQueue.size());
assertTrue(evenElementsQueue.contains(1));
assertTrue(evenElementsQueue.contains(3));
assertTrue(evenElementsQueue.contains(5));
assertEquals(3, oddElementsQueue.size());
assertTrue(oddElementsQueue.contains(1));
assertTrue(oddElementsQueue.contains(3));
assertTrue(oddElementsQueue.contains(5));
}
@Test