From 512d7cf5a68f9551461fecbf7a0dd2606e112624 Mon Sep 17 00:00:00 2001 From: plzdoo <55066376+plzdoo@users.noreply.github.com> Date: Sat, 16 Apr 2022 20:13:46 -0500 Subject: [PATCH] Update ReleaseMessageServiceWithCacheTest.java (#4314) * Update ReleaseMessageServiceWithCacheTest.java fix the flaky test. * Update ReleaseMessageServiceWithCacheTest.java propose fix --- .../service/ReleaseMessageServiceWithCacheTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/service/ReleaseMessageServiceWithCacheTest.java b/apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/service/ReleaseMessageServiceWithCacheTest.java index 3fafc196bec..be7eb24369d 100644 --- a/apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/service/ReleaseMessageServiceWithCacheTest.java +++ b/apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/service/ReleaseMessageServiceWithCacheTest.java @@ -150,14 +150,15 @@ public void testWhenReleaseMsgSizeBiggerThan500() throws Exception { assertNotNull(latestReleaseMsg); assertEquals(501, latestReleaseMsg.getId()); assertEquals(antherMsgContent, latestReleaseMsg.getMessage()); - + + List msgContentList = Arrays.asList(someMsgContent, antherMsgContent); List latestReleaseMsgGroupByMsgContent = releaseMessageServiceWithCache - .findLatestReleaseMessagesGroupByMessages(Sets.newHashSet(someMsgContent, antherMsgContent)); + .findLatestReleaseMessagesGroupByMessages(Sets.newLinkedHashSet(msgContentList)); assertEquals(2, latestReleaseMsgGroupByMsgContent.size()); - assertEquals(500, latestReleaseMsgGroupByMsgContent.get(1).getId()); - assertEquals(501, latestReleaseMsgGroupByMsgContent.get(0).getId()); + assertEquals(500, latestReleaseMsgGroupByMsgContent.get(0).getId()); + assertEquals(501, latestReleaseMsgGroupByMsgContent.get(1).getId()); } @Test