2424import java .util .StringTokenizer ;
2525
2626import org .apache .hadoop .test .GenericTestUtils ;
27- import org .junit .Assert ;
28-
27+ import org .junit .jupiter .api .AfterEach ;
28+ import org .junit .jupiter .api .BeforeEach ;
29+ import org .junit .jupiter .api .Test ;
2930import org .apache .hadoop .fs .permission .FsPermission ;
3031import org .apache .hadoop .security .UserGroupInformation ;
3132import org .apache .hadoop .util .Shell ;
3233import org .apache .hadoop .util .StringUtils ;
33- import org .junit .After ;
34- import org .junit .Before ;
35- import org .junit .Test ;
3634import org .slf4j .event .Level ;
3735
3836import static org .apache .hadoop .fs .FileContextTestHelper .*;
3937import static org .apache .hadoop .test .PlatformAssumptions .assumeNotWindows ;
40- import static org .junit .Assert .assertEquals ;
41- import static org .junit .Assert .fail ;
38+ import static org .junit .jupiter .api .Assertions .assertEquals ;
39+ import static org .junit .jupiter .api .Assertions .assertTrue ;
40+ import static org .junit .jupiter .api .Assertions .fail ;
4241
4342/**
4443 * <p>
5251 * test and override {@link #setUp()} to initialize the <code>fc</code>
5352 * {@link FileContext} instance variable.
5453 *
55- * Since this a junit 4 you can also do a single setup before
54+ * Since this a junit 4+ you can also do a single setup before
5655 * the start of any tests.
5756 * E.g.
5857 * @BeforeClass public static void clusterSetupAtBegining()
@@ -80,22 +79,22 @@ protected FileContextTestHelper getFileContextHelper() {
8079
8180 protected abstract FileContext getFileContext () throws Exception ;
8281
83- @ Before
82+ @ BeforeEach
8483 public void setUp () throws Exception {
8584 fileContextTestHelper = getFileContextHelper ();
8685 fc = getFileContext ();
8786 fc .mkdir (fileContextTestHelper .getTestRootPath (fc ), FileContext .DEFAULT_PERM , true );
8887 }
8988
90- @ After
89+ @ AfterEach
9190 public void tearDown () throws Exception {
9291 fc .delete (fileContextTestHelper .getTestRootPath (fc ), true );
9392 }
9493
9594 private void cleanupFile (FileContext fc , Path name ) throws IOException {
96- Assert . assertTrue (exists (fc , name ));
95+ assertTrue (exists (fc , name ));
9796 fc .delete (name , true );
98- Assert . assertTrue (!exists (fc , name ));
97+ assertTrue (!exists (fc , name ));
9998 }
10099
101100 @ Test
@@ -158,12 +157,12 @@ public void testSetOwner() throws IOException {
158157 try {
159158 String g0 = groups .get (0 );
160159 fc .setOwner (f , null , g0 );
161- Assert . assertEquals (g0 , fc .getFileStatus (f ).getGroup ());
160+ assertEquals (fc .getFileStatus (f ).getGroup (), g0 );
162161
163162 if (groups .size () > 1 ) {
164163 String g1 = groups .get (1 );
165164 fc .setOwner (f , null , g1 );
166- Assert . assertEquals (g1 , fc .getFileStatus (f ).getGroup ());
165+ assertEquals (fc .getFileStatus (f ).getGroup (), g1 );
167166 } else {
168167 System .out .println ("Not testing changing the group since user " +
169168 "belongs to only one group." );
@@ -193,7 +192,7 @@ public FileContext run() throws Exception {
193192 }
194193
195194 });
196- assertEquals ("otherUser" , newFc .getUgi ().getUserName ());
195+ assertEquals (newFc .getUgi ().getUserName (), "otherUser" );
197196 }
198197
199198 static List <String > getGroups () throws IOException {
@@ -207,7 +206,7 @@ static List<String> getGroups() throws IOException {
207206
208207
209208 void doFilePermissionCheck (FsPermission expectedPerm , FsPermission actualPerm ) {
210- Assert . assertEquals (expectedPerm .applyUMask (getFileMask ()), actualPerm );
209+ assertEquals (expectedPerm .applyUMask (getFileMask ()), actualPerm );
211210 }
212211
213212
0 commit comments