Skip to content

Commit b89642d

Browse files
committed
fix unitest for prority queue
1 parent fbc29a0 commit b89642d

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

platform-core/src/test/java/com/flow/platform/core/test/PlatformQueueTest.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public void should_enqueue_for_rabbit_queue() throws Throwable {
8282
@Test
8383
public void should_enqueue_with_priority_in_memory_queue() throws Throwable {
8484
// given: queue listener
85-
final int size = 4;
85+
final int size = 6;
8686
CountDownLatch latch = new CountDownLatch(size);
8787
List<String> prioritizedList = new ArrayList<>(size);
8888

@@ -100,17 +100,23 @@ public void should_enqueue_with_priority_in_memory_queue() throws Throwable {
100100
inMemoryQueue.enqueue(PriorityMessage.create("3".getBytes(), 10));
101101
ThreadUtil.sleep(1);
102102
inMemoryQueue.enqueue(PriorityMessage.create("4".getBytes(), 10));
103+
ThreadUtil.sleep(1);
104+
inMemoryQueue.enqueue(PriorityMessage.create("5".getBytes(), 10));
105+
ThreadUtil.sleep(1);
106+
inMemoryQueue.enqueue(PriorityMessage.create("6".getBytes(), 10));
103107
inMemoryQueue.start();
104108

105109
// then:
106110
boolean await = latch.await(60, TimeUnit.SECONDS);
107111
Assert.assertTrue(await);
108112
Assert.assertEquals(size, prioritizedList.size());
109113

110-
Assert.assertEquals("4", prioritizedList.get(0));
111-
Assert.assertEquals("3", prioritizedList.get(1));
112-
Assert.assertEquals("2", prioritizedList.get(2));
113-
Assert.assertEquals("1", prioritizedList.get(3));
114+
Assert.assertEquals("3", prioritizedList.get(0));
115+
Assert.assertEquals("4", prioritizedList.get(1));
116+
Assert.assertEquals("5", prioritizedList.get(2));
117+
Assert.assertEquals("6", prioritizedList.get(3));
118+
Assert.assertEquals("1", prioritizedList.get(4));
119+
Assert.assertEquals("2", prioritizedList.get(5));
114120
}
115121

116122
@Test

0 commit comments

Comments
 (0)