未验证 提交 7028af68 编写于 作者: H Heng Du 提交者: GitHub

Merge pull request #1554 from keranbingaa/unit-test

[ISSUE #1528]modify unit test of producer
...@@ -189,7 +189,7 @@ public class DefaultMQProducerTest { ...@@ -189,7 +189,7 @@ public class DefaultMQProducerTest {
@Test @Test
public void testSendMessageAsync_Success() throws RemotingException, InterruptedException, MQBrokerException, MQClientException { public void testSendMessageAsync_Success() throws RemotingException, InterruptedException, MQBrokerException, MQClientException {
final CountDownLatch countDownLatch = new CountDownLatch(1); 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()); when(mQClientAPIImpl.getTopicRouteInfoFromNameServer(anyString(), anyLong())).thenReturn(createTopicRoute());
producer.send(message, new SendCallback() { producer.send(message, new SendCallback() {
@Override @Override
...@@ -198,15 +198,15 @@ public class DefaultMQProducerTest { ...@@ -198,15 +198,15 @@ public class DefaultMQProducerTest {
assertThat(sendResult.getOffsetMsgId()).isEqualTo("123"); assertThat(sendResult.getOffsetMsgId()).isEqualTo("123");
assertThat(sendResult.getQueueOffset()).isEqualTo(456L); assertThat(sendResult.getQueueOffset()).isEqualTo(456L);
countDownLatch.countDown(); countDownLatch.countDown();
// cc.incrementAndGet(); cc.incrementAndGet();
} }
@Override @Override
public void onException(Throwable e) { public void onException(Throwable e) {
} }
}); });
countDownLatch.await(3000L, TimeUnit.MILLISECONDS); countDownLatch.await(8000L, TimeUnit.MILLISECONDS);
// assertThat(cc.get()).isEqualTo(1); assertThat(cc.get()).isEqualTo(1);
} }
@Test @Test
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册