Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

Commit

Permalink
add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wutao1 committed Nov 2, 2019
1 parent 93b1590 commit 08ef979
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/test/java/com/xiaomi/infra/pegasus/client/TestPException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) 2019, Xiaomi, Inc. All rights reserved.
// This source code is licensed under the Apache License Version 2.0, which
// can be found in the LICENSE file in the root directory of this source tree.

package com.xiaomi.infra.pegasus.client;

import org.junit.Assert;
import org.junit.Test;

public class TestPException {
@Test
public void testThreadInterrupted() throws Exception {
PException ex = PException.threadInterrupted("test");
Assert.assertEquals(
"com.xiaomi.infra.pegasus.rpc.ReplicationException: ERR_THREAD_INTERRUPTED: [table=test] Thread is interrupted!",
ex.getMessage());
}

@Test
public void testTimeout() throws Exception {
PException ex = PException.timeout("test", 1000);
Assert.assertEquals(
"com.xiaomi.infra.pegasus.rpc.ReplicationException: ERR_TIMEOUT: [table=test, timeout=1000ms] Timeout on Future await!",
ex.getMessage());
}
}

0 comments on commit 08ef979

Please sign in to comment.