1919
2020import static org .junit .Assert .assertEquals ;
2121import static org .junit .Assert .assertTrue ;
22+ import static org .junit .Assert .fail ;
2223
2324import java .io .IOException ;
2425import java .util .List ;
4041import org .junit .Rule ;
4142import org .junit .Test ;
4243import org .junit .experimental .categories .Category ;
43- import org .junit .rules .ExpectedException ;
4444import 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