This repository has been archived by the owner on May 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wutao1
committed
Nov 2, 2019
1 parent
93b1590
commit 08ef979
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/test/java/com/xiaomi/infra/pegasus/client/TestPException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |