Skip to content

Commit

Permalink
Update ReleaseMessageServiceWithCacheTest.java (#4314)
Browse files Browse the repository at this point in the history
* Update ReleaseMessageServiceWithCacheTest.java

fix the flaky test.

* Update ReleaseMessageServiceWithCacheTest.java

propose fix
  • Loading branch information
plzdoo authored Apr 17, 2022
1 parent a42b793 commit 512d7cf
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,15 @@ public void testWhenReleaseMsgSizeBiggerThan500() throws Exception {
assertNotNull(latestReleaseMsg);
assertEquals(501, latestReleaseMsg.getId());
assertEquals(antherMsgContent, latestReleaseMsg.getMessage());


List<String> msgContentList = Arrays.asList(someMsgContent, antherMsgContent);
List<ReleaseMessage> 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
Expand Down

0 comments on commit 512d7cf

Please sign in to comment.