8383import  org .apache .hadoop .yarn .server .api .protocolrecords .ReportNewCollectorInfoResponse ;
8484import  org .apache .hadoop .yarn .server .api .records .AppCollectorData ;
8585import  org .apache .hadoop .yarn .util .Records ;
86- import  org .junit .Assert ;
87- import  org .junit .Test ;
86+ import  org .junit .jupiter . api . Assertions ;
87+ import  org .junit .jupiter . api . Test ;
8888
8989public  class  TestRPC  {
9090
@@ -136,9 +136,9 @@ public void testUnknownCall() {
136136    try  {
137137      proxy .getNewApplication (Records 
138138          .newRecord (GetNewApplicationRequest .class ));
139-       Assert .fail ("Excepted RPC call to fail with unknown method." );
139+       Assertions .fail ("Excepted RPC call to fail with unknown method." );
140140    } catch  (YarnException  e ) {
141-       Assert .assertTrue (e .getMessage ().matches (
141+       Assertions .assertTrue (e .getMessage ().matches (
142142          "Unknown method getNewApplication called on.*" 
143143              + "org.apache.hadoop.yarn.proto.ApplicationClientProtocol" 
144144              + "\\ $ApplicationClientProtocolService\\ $BlockingInterface " 
@@ -171,9 +171,9 @@ public void testRPCOnCollectorNodeManagerProtocol() throws IOException {
171171    try  {
172172      unknownProxy .getNewApplication (Records 
173173          .newRecord (GetNewApplicationRequest .class ));
174-       Assert .fail ("Excepted RPC call to fail with unknown method." );
174+       Assertions .fail ("Excepted RPC call to fail with unknown method." );
175175    } catch  (YarnException  e ) {
176-       Assert .assertTrue (e .getMessage ().matches (
176+       Assertions .assertTrue (e .getMessage ().matches (
177177          "Unknown method getNewApplication called on.*" 
178178              + "org.apache.hadoop.yarn.proto.ApplicationClientProtocol" 
179179              + "\\ $ApplicationClientProtocolService\\ $BlockingInterface " 
@@ -195,7 +195,7 @@ public void testRPCOnCollectorNodeManagerProtocol() throws IOException {
195195              DEFAULT_APP_ID , DEFAULT_COLLECTOR_ADDR , null );
196196      proxy .reportNewCollectorInfo (request );
197197    } catch  (YarnException  e ) {
198-       Assert .fail ("RPC call failured is not expected here." );
198+       Assertions .fail ("RPC call failured is not expected here." );
199199    }
200200
201201    try  {
@@ -204,17 +204,17 @@ public void testRPCOnCollectorNodeManagerProtocol() throws IOException {
204204              DEFAULT_APP_ID , DEFAULT_COLLECTOR_ADDR , DEFAULT_COLLECTOR_TOKEN );
205205      proxy .reportNewCollectorInfo (request );
206206    } catch  (YarnException  e ) {
207-       Assert .fail ("RPC call failured is not expected here." );
207+       Assertions .fail ("RPC call failured is not expected here." );
208208    }
209209
210210    // Verify empty request get YarnException back (by design in 
211211    // DummyNMCollectorService) 
212212    try  {
213213      proxy .reportNewCollectorInfo (Records 
214214          .newRecord (ReportNewCollectorInfoRequest .class ));
215-       Assert .fail ("Excepted RPC call to fail with YarnException." );
215+       Assertions .fail ("Excepted RPC call to fail with YarnException." );
216216    } catch  (YarnException  e ) {
217-       Assert .assertTrue (e .getMessage ().contains (ILLEGAL_NUMBER_MESSAGE ));
217+       Assertions .assertTrue (e .getMessage ().contains (ILLEGAL_NUMBER_MESSAGE ));
218218    }
219219
220220    // Verify request with a valid app ID 
@@ -224,12 +224,12 @@ public void testRPCOnCollectorNodeManagerProtocol() throws IOException {
224224              ApplicationId .newInstance (0 , 1 ));
225225      GetTimelineCollectorContextResponse  response  =
226226          proxy .getTimelineCollectorContext (request );
227-       Assert .assertEquals ("test_user_id" , response .getUserId ());
228-       Assert .assertEquals ("test_flow_name" , response .getFlowName ());
229-       Assert .assertEquals ("test_flow_version" , response .getFlowVersion ());
230-       Assert .assertEquals (12345678L , response .getFlowRunId ());
227+       Assertions .assertEquals ("test_user_id" , response .getUserId ());
228+       Assertions .assertEquals ("test_flow_name" , response .getFlowName ());
229+       Assertions .assertEquals ("test_flow_version" , response .getFlowVersion ());
230+       Assertions .assertEquals (12345678L , response .getFlowRunId ());
231231    } catch  (YarnException  | IOException  e ) {
232-       Assert .fail ("RPC call failured is not expected here." );
232+       Assertions .fail ("RPC call failured is not expected here." );
233233    }
234234
235235    // Verify request with an invalid app ID 
@@ -238,10 +238,10 @@ public void testRPCOnCollectorNodeManagerProtocol() throws IOException {
238238          GetTimelineCollectorContextRequest .newInstance (
239239              ApplicationId .newInstance (0 , 2 ));
240240      proxy .getTimelineCollectorContext (request );
241-       Assert .fail ("RPC call failured is expected here." );
241+       Assertions .fail ("RPC call failured is expected here." );
242242    } catch  (YarnException  | IOException  e ) {
243-       Assert .assertTrue (e  instanceof   YarnException );
244-       Assert .assertTrue (e .getMessage ().contains (
243+       Assertions .assertTrue (e  instanceof   YarnException );
244+       Assertions .assertTrue (e .getMessage ().contains (
245245          "The application is not found." ));
246246    }
247247    server .stop ();
@@ -309,17 +309,17 @@ private void test(String rpcClass) throws Exception {
309309      proxy .stopContainers (stopRequest );
310310    } catch  (YarnException  e ) {
311311      exception  = true ;
312-       Assert .assertTrue (e .getMessage ().contains (EXCEPTION_MSG ));
313-       Assert .assertTrue (e .getMessage ().contains (EXCEPTION_CAUSE ));
312+       Assertions .assertTrue (e .getMessage ().contains (EXCEPTION_MSG ));
313+       Assertions .assertTrue (e .getMessage ().contains (EXCEPTION_CAUSE ));
314314      System .out .println ("Test Exception is "  + e .getMessage ());
315315    } catch  (Exception  ex ) {
316316      ex .printStackTrace ();
317317    } finally  {
318318      server .stop ();
319319    }
320-     Assert .assertTrue (exception );
321-     Assert .assertNotNull (statuses .get (0 ));
322-     Assert .assertEquals (ContainerState .RUNNING , statuses .get (0 ).getState ());
320+     Assertions .assertTrue (exception );
321+     Assertions .assertNotNull (statuses .get (0 ));
322+     Assertions .assertEquals (ContainerState .RUNNING , statuses .get (0 ).getState ());
323323  }
324324
325325  public  class  DummyContainerManager  implements  ContainerManagementProtocol  {
@@ -468,11 +468,11 @@ public ReportNewCollectorInfoResponse reportNewCollectorInfo(
468468      if  (appCollectors .size () == 1 ) {
469469        // check default appID and collectorAddr 
470470        AppCollectorData  appCollector  = appCollectors .get (0 );
471-         Assert .assertEquals (appCollector .getApplicationId (),
471+         Assertions .assertEquals (appCollector .getApplicationId (),
472472            DEFAULT_APP_ID );
473-         Assert .assertEquals (appCollector .getCollectorAddr (),
473+         Assertions .assertEquals (appCollector .getCollectorAddr (),
474474            DEFAULT_COLLECTOR_ADDR );
475-         Assert .assertTrue (appCollector .getCollectorToken () == null  ||
475+         Assertions .assertTrue (appCollector .getCollectorToken () == null  ||
476476            appCollector .getCollectorToken ().equals (DEFAULT_COLLECTOR_TOKEN ));
477477      } else  {
478478        throw  new  YarnException (ILLEGAL_NUMBER_MESSAGE );
0 commit comments