Skip to content

Commit

Permalink
Merge pull request alibaba#1554 from keranbingaa/unit-test
Browse files Browse the repository at this point in the history
[ISSUE alibaba#1528]modify unit test of producer
  • Loading branch information
duhenglucky authored Nov 14, 2019
2 parents e735fff + b8e1be8 commit 7028af6
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void testSendMessageSync_WithBodyCompressed() throws RemotingException, I
@Test
public void testSendMessageAsync_Success() throws RemotingException, InterruptedException, MQBrokerException, MQClientException {
final CountDownLatch countDownLatch = new CountDownLatch(1);
// final AtomicInteger cc = new AtomicInteger(0);
final AtomicInteger cc = new AtomicInteger(0);
when(mQClientAPIImpl.getTopicRouteInfoFromNameServer(anyString(), anyLong())).thenReturn(createTopicRoute());
producer.send(message, new SendCallback() {
@Override
Expand All @@ -198,15 +198,15 @@ public void onSuccess(SendResult sendResult) {
assertThat(sendResult.getOffsetMsgId()).isEqualTo("123");
assertThat(sendResult.getQueueOffset()).isEqualTo(456L);
countDownLatch.countDown();
// cc.incrementAndGet();
cc.incrementAndGet();
}

@Override
public void onException(Throwable e) {
}
});
countDownLatch.await(3000L, TimeUnit.MILLISECONDS);
// assertThat(cc.get()).isEqualTo(1);
countDownLatch.await(8000L, TimeUnit.MILLISECONDS);
assertThat(cc.get()).isEqualTo(1);
}

@Test
Expand Down

0 comments on commit 7028af6

Please sign in to comment.