@Test public void buildPort_PortIsNullAndMandatory_Exception() throws Exception { final String port = null; final boolean mandatory = true; exception.expect(Exception.class); InputBuilderUtils.buildPort(port, mandatory); }
public static Short buildPort(String port, boolean mandatory) throws Exception { if (StringUtils.isEmpty(port)) { if (!mandatory) { return null; } else { throw new Exception(ExceptionMsgs.PORT_NOT_SPECIFIED); } } else { Short p = Short.parseShort(port); if (p < 1) { throw new Exception(ExceptionMsgs.INVALID_PORT_NUMBER); } return p; } }
InputBuilderUtils { public static Short buildPort(String port, boolean mandatory) throws Exception { if (StringUtils.isEmpty(port)) { if (!mandatory) { return null; } else { throw new Exception(ExceptionMsgs.PORT_NOT_SPECIFIED); } } else { Short p = Short.parseShort(port); if (p < 1) { throw new Exception(ExceptionMsgs.INVALID_PORT_NUMBER); } return p; } } }
InputBuilderUtils { public static Short buildPort(String port, boolean mandatory) throws Exception { if (StringUtils.isEmpty(port)) { if (!mandatory) { return null; } else { throw new Exception(ExceptionMsgs.PORT_NOT_SPECIFIED); } } else { Short p = Short.parseShort(port); if (p < 1) { throw new Exception(ExceptionMsgs.INVALID_PORT_NUMBER); } return p; } }  }
InputBuilderUtils { public static Short buildPort(String port, boolean mandatory) throws Exception { if (StringUtils.isEmpty(port)) { if (!mandatory) { return null; } else { throw new Exception(ExceptionMsgs.PORT_NOT_SPECIFIED); } } else { Short p = Short.parseShort(port); if (p < 1) { throw new Exception(ExceptionMsgs.INVALID_PORT_NUMBER); } return p; } }  static String buildHostname(String hostname); static Short buildPort(String port, boolean mandatory); static Map<String, Object> buildPortAndProtocol(String protocol, String port); static String buildUsername(String username, boolean mandatory); static String buildPassword(String password); static boolean buildTrustAllRoots(String trustAllRoots); static boolean buildEnableTLS(String enableTLS); static boolean buildEnableSSL(String enableSSL); static boolean buildDeleteUponRetrieval(String deleteUponRetrieval); static String buildKeystore(String keystore); static int buildTimeout(String timeout); static Map<String, String> buildDecryptionKeystore(String decryptionKeystore, String decryptionKeyAlias,
                                                              String decryptionKeystorePassword); static List<String> buildTlsVersions(String tlsVersionInput); static List<String> buildAllowedCiphers(String allowedCiphersInput); }
InputBuilderUtils { public static Short buildPort(String port, boolean mandatory) throws Exception { if (StringUtils.isEmpty(port)) { if (!mandatory) { return null; } else { throw new Exception(ExceptionMsgs.PORT_NOT_SPECIFIED); } } else { Short p = Short.parseShort(port); if (p < 1) { throw new Exception(ExceptionMsgs.INVALID_PORT_NUMBER); } return p; } }  static String buildHostname(String hostname); static Short buildPort(String port, boolean mandatory); static Map<String, Object> buildPortAndProtocol(String protocol, String port); static String buildUsername(String username, boolean mandatory); static String buildPassword(String password); static boolean buildTrustAllRoots(String trustAllRoots); static boolean buildEnableTLS(String enableTLS); static boolean buildEnableSSL(String enableSSL); static boolean buildDeleteUponRetrieval(String deleteUponRetrieval); static String buildKeystore(String keystore); static int buildTimeout(String timeout); static Map<String, String> buildDecryptionKeystore(String decryptionKeystore, String decryptionKeyAlias,
                                                              String decryptionKeystorePassword); static List<String> buildTlsVersions(String tlsVersionInput); static List<String> buildAllowedCiphers(String allowedCiphersInput);  }