Skip to content

Commit 909a766

Browse files
committed
Update test units
1 parent 0a637ff commit 909a766

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScanOrGetWithReplicationFromClient.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import static org.junit.Assert.assertEquals;
2121
import static org.junit.Assert.assertTrue;
22+
import static org.junit.Assert.fail;
2223

2324
import java.io.IOException;
2425
import java.util.List;
@@ -40,7 +41,6 @@
4041
import org.junit.Rule;
4142
import org.junit.Test;
4243
import org.junit.experimental.categories.Category;
43-
import org.junit.rules.ExpectedException;
4444
import org.junit.rules.TestName;
4545

4646
@Category({ MediumTests.class, ClientTests.class })
@@ -52,8 +52,6 @@ public class TestScanOrGetWithReplicationFromClient {
5252
@Rule
5353
public TestName name = new TestName();
5454

55-
private ExpectedException exception = ExpectedException.none();
56-
5755
private final static HBaseTestingUtil UTIL = new HBaseTestingUtil();
5856
private static final String ROW = "r1";
5957
private static final byte[] FAMILY = Bytes.toBytes("info");
@@ -127,10 +125,10 @@ public void testScanMetaWithNonExistingRegionReplicaId() throws IOException {
127125
Scan scan = new Scan();
128126
scan.setReplicaId(NON_EXISTING_REGION_REPLICA_ID);
129127
scan.setConsistency(Consistency.TIMELINE);
130-
exception.expect(DoNotRetryIOException.class);
131128
ResultScanner rs = metaTable.getScanner(scan);
132129
try {
133130
rs.forEach(r -> Bytes.toString(r.getRow()));
131+
fail("Should not reach here");
134132
} catch (Exception e) {
135133
Throwable throwable = e.getCause();
136134
assertTrue(throwable instanceof DoNotRetryIOException);
@@ -160,10 +158,10 @@ public void testScanTableWithNonExistingRegionReplicaId() throws IOException {
160158
Scan scan = new Scan();
161159
scan.setReplicaId(NON_EXISTING_REGION_REPLICA_ID);
162160
scan.setConsistency(Consistency.TIMELINE);
163-
exception.expect(DoNotRetryIOException.class);
164161
ResultScanner rs = table.getScanner(scan);
165162
try {
166163
rs.forEach(r -> Bytes.toString(r.getRow()));
164+
fail("Should not reach here");
167165
} catch (Exception e) {
168166
Throwable throwable = e.getCause();
169167
assertTrue(throwable instanceof DoNotRetryIOException);
@@ -195,6 +193,7 @@ public void testGetTableWithNonExistingRegionReplicaId() throws IOException {
195193
try {
196194
Result result = table.get(get);
197195
result.getValue(FAMILY, Bytes.toBytes("q"));
196+
fail("Should not reach here");
198197
} catch (Exception e) {
199198
assertTrue(e instanceof DoNotRetryIOException);
200199
String message = "The specified region replica id " + NON_EXISTING_REGION_REPLICA_ID

0 commit comments

Comments
 (0)