@Override
  public SubmitApplicationResponse submitApplication(
      SubmitApplicationRequest request) throws YarnException, IOException {

    if (request == null || request.getApplicationSubmissionContext() == null ||
        request.getApplicationSubmissionContext().getApplicationId() == null) {
      RouterMetrics.getMetrics().incrAppsFailedSubmitted();
      String errMsg =
          "Missing submitApplication request or applicationSubmissionContext information.";
      RouterAuditLogger.logFailure(user.getShortUserName(), SUBMIT_NEW_APP, UNKNOWN,
          TARGET_CLIENT_RM_SERVICE, errMsg);
      RouterServerUtil.logAndThrowException(errMsg, null);
    }

    ApplicationSubmissionContext appContext = request.getApplicationSubmissionContext();
    ApplicationSubmissionContextPBImpl asc = (ApplicationSubmissionContextPBImpl) appContext;

    // Check for excessively large fields, throw exception if found
    RouterServerUtil.checkAppSubmissionContext(asc, getConf());

    // Check succeeded - app submit will be passed on to the next interceptor
    return getNextInterceptor().submitApplication(request);
  }
@Test
  public void testSubmitApplicationEmptyRequest() throws Exception {

    MockRouterClientRMService rmService = getRouterClientRMService();
    LambdaTestUtils.intercept(YarnException.class,
        "Missing submitApplication request or applicationSubmissionContext information.",
        () -> rmService.submitApplication(null));

    ApplicationSubmissionContext context = ApplicationSubmissionContext.newInstance(
        null, "", "", null, null, false, false, -1, null, null);
    SubmitApplicationRequest request = SubmitApplicationRequest.newInstance(context);
    LambdaTestUtils.intercept(YarnException.class,
        "Missing submitApplication request or applicationSubmissionContext information.",
        () -> rmService.submitApplication(null));
  }