@Test public void testUseridNotNull() { try { InputValidator.validateUserIdNotNull("c","m","A1"); } catch (InvalidParameterException e) { fail("Non null should not fail"); } try { InputValidator.validateUserIdNotNull("c","m",null); } catch (InvalidParameterException e) { System.out.println("Expected error message " + e.getReportedErrorMessageId()); if (e.getReportedErrorMessage().contains("{") || e.getReportedErrorMessage().contains("}") ){ fail("inserts not correct"); } } }
static public void validateUserIdNotNull( String className, String actionDescription, String userId) throws InvalidParameterException { if (userId == null) { ExceptionMessageDefinition messageDefinition = SubjectAreaErrorCode.NULL_USER_ID.getMessageDefinition(); String invalidPropertyName = "userId"; messageDefinition.setMessageParameters(invalidPropertyName, null); throw new InvalidParameterException(messageDefinition, className, actionDescription, invalidPropertyName, null); } }
InputValidator { static public void validateUserIdNotNull( String className, String actionDescription, String userId) throws InvalidParameterException { if (userId == null) { ExceptionMessageDefinition messageDefinition = SubjectAreaErrorCode.NULL_USER_ID.getMessageDefinition(); String invalidPropertyName = "userId"; messageDefinition.setMessageParameters(invalidPropertyName, null); throw new InvalidParameterException(messageDefinition, className, actionDescription, invalidPropertyName, null); } } }
InputValidator { static public void validateUserIdNotNull( String className, String actionDescription, String userId) throws InvalidParameterException { if (userId == null) { ExceptionMessageDefinition messageDefinition = SubjectAreaErrorCode.NULL_USER_ID.getMessageDefinition(); String invalidPropertyName = "userId"; messageDefinition.setMessageParameters(invalidPropertyName, null); throw new InvalidParameterException(messageDefinition, className, actionDescription, invalidPropertyName, null); } }  }
InputValidator { static public void validateUserIdNotNull( String className, String actionDescription, String userId) throws InvalidParameterException { if (userId == null) { ExceptionMessageDefinition messageDefinition = SubjectAreaErrorCode.NULL_USER_ID.getMessageDefinition(); String invalidPropertyName = "userId"; messageDefinition.setMessageParameters(invalidPropertyName, null); throw new InvalidParameterException(messageDefinition, className, actionDescription, invalidPropertyName, null); } }  static void validateRemoteServerURLNotNull(String className, String actionDescription, String omasServerURL); static void validateRemoteServerNameNotNull(String className, String actionDescription, String omasServerName); static void validateUserIdNotNull(
            String className,
            String actionDescription,
            String userId); static Status validateStatusAndCheckNotDeleted(
            String className,
            String actionDescription,
            String statusName); static void validateGUIDNotNull(
            String className,
            String actionDescription,
            String guid,
            String guidParameter); static void validateNameNotNull(String className,
                                           String actionDescription,
                                           String name,
                                           String nameParameter
                                          ); static void validateNodeType(Object... args); }
InputValidator { static public void validateUserIdNotNull( String className, String actionDescription, String userId) throws InvalidParameterException { if (userId == null) { ExceptionMessageDefinition messageDefinition = SubjectAreaErrorCode.NULL_USER_ID.getMessageDefinition(); String invalidPropertyName = "userId"; messageDefinition.setMessageParameters(invalidPropertyName, null); throw new InvalidParameterException(messageDefinition, className, actionDescription, invalidPropertyName, null); } }  static void validateRemoteServerURLNotNull(String className, String actionDescription, String omasServerURL); static void validateRemoteServerNameNotNull(String className, String actionDescription, String omasServerName); static void validateUserIdNotNull(
            String className,
            String actionDescription,
            String userId); static Status validateStatusAndCheckNotDeleted(
            String className,
            String actionDescription,
            String statusName); static void validateGUIDNotNull(
            String className,
            String actionDescription,
            String guid,
            String guidParameter); static void validateNameNotNull(String className,
                                           String actionDescription,
                                           String name,
                                           String nameParameter
                                          ); static void validateNodeType(Object... args);  }