1717 */
1818package org .apache .hadoop .hbase .snapshot ;
1919
20- import static org .junit .Assert .assertEquals ;
21- import static org .junit .Assert .assertTrue ;
20+ import static org .junit .jupiter . api . Assertions .assertEquals ;
21+ import static org .junit .jupiter . api . Assertions .assertTrue ;
2222
2323import java .util .ArrayList ;
2424import java .util .Collection ;
@@ -107,7 +107,7 @@ public void testGroupFilesForSplitsWithoutCustomFileGrouper() {
107107 Collection <List <Pair <SnapshotFileInfo , Long >>> groups =
108108 inputFormat .groupFilesForSplits (conf , files );
109109
110- assertEquals ("Should create 3 groups" , 3 , groups . size () );
110+ assertEquals (3 , groups . size (), "Should create 3 groups" );
111111
112112 long totalSize = 0 ;
113113 int totalFiles = 0 ;
@@ -118,8 +118,8 @@ public void testGroupFilesForSplitsWithoutCustomFileGrouper() {
118118 }
119119 }
120120
121- assertEquals ("All files should be included" , 10 , totalFiles );
122- assertEquals ("Total size should be preserved" , 450 , totalSize );
121+ assertEquals (10 , totalFiles , "All files should be included" );
122+ assertEquals (450 , totalSize , "Total size should be preserved" );
123123 }
124124
125125 @ Test
@@ -141,7 +141,7 @@ public void testGroupFilesForSplitsWithCustomFileGrouper() {
141141 Collection <List <Pair <SnapshotFileInfo , Long >>> groups =
142142 inputFormat .groupFilesForSplits (conf , files );
143143
144- assertEquals ("Should create splits based on custom grouper output" , 4 , groups . size () );
144+ assertEquals (4 , groups . size (), "Should create splits based on custom grouper output" );
145145
146146 long totalSize = 0 ;
147147 int totalFiles = 0 ;
@@ -152,8 +152,8 @@ public void testGroupFilesForSplitsWithCustomFileGrouper() {
152152 }
153153 }
154154
155- assertEquals ("All files should be included" , 8 , totalFiles );
156- assertEquals ("Total size should be preserved" , 140 , totalSize );
155+ assertEquals (8 , totalFiles , "All files should be included" );
156+ assertEquals (140 , totalSize , "Total size should be preserved" );
157157 }
158158
159159 @ Test
@@ -169,7 +169,7 @@ public void testFileLocationResolverWithNoopResolver() {
169169 new ExportSnapshot .NoopFileLocationResolver ();
170170 Set <String > locations = resolver .getLocationsForInputFiles (files );
171171
172- assertTrue ("NoopFileLocationResolver should return empty locations" , locations . isEmpty () );
172+ assertTrue (locations . isEmpty (), "NoopFileLocationResolver should return empty locations" );
173173 }
174174
175175 @ Test
@@ -184,13 +184,13 @@ public void testFileLocationResolverWithCustomResolver() {
184184 TestFileLocationResolver resolver = new TestFileLocationResolver ();
185185 Set <String > locations = resolver .getLocationsForInputFiles (files );
186186
187- assertEquals ("Should return expected locations" , 2 , locations . size () );
188- assertTrue ("Should contain rack1" , locations .contains ("rack1" ));
189- assertTrue ("Should contain rack2" , locations .contains ("rack2" ));
187+ assertEquals (2 , locations . size (), "Should return expected locations" );
188+ assertTrue (locations .contains ("rack1" ), "Should contain rack1" );
189+ assertTrue (locations .contains ("rack2" ), "Should contain rack2" );
190190 }
191191
192192 @ Test
193- public void testInputSplitWithFileLocationResolver () {
193+ public void testInputSplitWithFileLocationResolver () throws Exception {
194194 List <Pair <SnapshotFileInfo , Long >> files = new ArrayList <>();
195195 for (long i = 0 ; i < 3 ; i ++) {
196196 SnapshotFileInfo fileInfo = SnapshotFileInfo .newBuilder ().setType (SnapshotFileInfo .Type .HFILE )
@@ -202,26 +202,22 @@ public void testInputSplitWithFileLocationResolver() {
202202 ExportSnapshot .ExportSnapshotInputFormat .ExportSnapshotInputSplit split =
203203 new ExportSnapshot .ExportSnapshotInputFormat .ExportSnapshotInputSplit (files , resolver );
204204
205- try {
206- String [] locations = split .getLocations ();
207- assertEquals ("Should return 2 locations" , 2 , locations .length );
205+ String [] locations = split .getLocations ();
206+ assertEquals (2 , locations .length , "Should return 2 locations" );
208207
209- boolean hasRack1 = false ;
210- boolean hasRack2 = false ;
211- for (String location : locations ) {
212- if ("rack1" .equals (location )) {
213- hasRack1 = true ;
214- }
215- if ("rack2" .equals (location )) {
216- hasRack2 = true ;
217- }
208+ boolean hasRack1 = false ;
209+ boolean hasRack2 = false ;
210+ for (String location : locations ) {
211+ if ("rack1" .equals (location )) {
212+ hasRack1 = true ;
213+ }
214+ if ("rack2" .equals (location )) {
215+ hasRack2 = true ;
218216 }
219-
220- assertTrue ("Should contain rack1" , hasRack1 );
221- assertTrue ("Should contain rack2" , hasRack2 );
222- } catch (Exception e ) {
223- throw new RuntimeException ("Failed to get locations" , e );
224217 }
218+
219+ assertTrue (hasRack1 , "Should contain rack1" );
220+ assertTrue (hasRack2 , "Should contain rack2" );
225221 }
226222
227223 public static class TestCustomFileGrouper implements ExportSnapshot .CustomFileGrouper {
0 commit comments