File tree Expand file tree Collapse file tree
hbase-server/src/test/java/org/apache/hadoop/hbase/client Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -330,13 +330,10 @@ public void testCreateSnapshotWithNonExistingTable() throws Exception {
330330 String snapshotName = tableName .getNameAsString () + "snap1" ;
331331
332332 try {
333- try {
334- // Create snapshot without creating table
335- TEST_UTIL .getAdmin ().snapshot (snapshotName , tableName );
336- fail ("Snapshot operation should fail, table doesn't exist" );
337- } catch (Exception e ) {
338- assertTrue (e instanceof SnapshotCreationException );
339- }
333+ // Create snapshot without creating table
334+ assertThrows ("Snapshot operation should fail, table doesn't exist" ,
335+ SnapshotCreationException .class ,
336+ () -> TEST_UTIL .getAdmin ().snapshot (snapshotName , tableName ));
340337
341338 // Create the table
342339 TableDescriptor htd = TableDescriptorBuilder .newBuilder (tableName ).build ();
You can’t perform that action at this time.
0 commit comments