@Test public void testCheckForNullFields() { HashMap<String, Object> map = new HashMap<>(); map.put("foo", new Object()); map.put("foo1", new Object()); map.put("foo2", new Object()); map.put("foo3", new Object()); try { ValidateUtil.checkForNullFields(map); } catch (VmidcBrokerInvalidEntryException e) { fail("Error in checkForNullFields. No fields are null and exception happens"); } map.clear(); map.put("foo", new Object()); map.put("foo1", null); map.put("foo2", new Object()); map.put("foo3", new Object()); try { ValidateUtil.checkForNullFields(map); fail("Error in checkForNullFields, fields are null and exception does not happen"); } catch (VmidcBrokerInvalidEntryException e) { } }
public static void checkForNullFields(Map<String, Object> map) throws VmidcBrokerInvalidEntryException { for (Entry<String, Object> entry : map.entrySet()) { String field = entry.getKey(); Object value = entry.getValue(); if (value == null || value.equals("")) { throw new VmidcBrokerInvalidEntryException(field + " should not have an empty value."); } } }
ValidateUtil implements ValidationApi { public static void checkForNullFields(Map<String, Object> map) throws VmidcBrokerInvalidEntryException { for (Entry<String, Object> entry : map.entrySet()) { String field = entry.getKey(); Object value = entry.getValue(); if (value == null || value.equals("")) { throw new VmidcBrokerInvalidEntryException(field + " should not have an empty value."); } } } }
ValidateUtil implements ValidationApi { public static void checkForNullFields(Map<String, Object> map) throws VmidcBrokerInvalidEntryException { for (Entry<String, Object> entry : map.entrySet()) { String field = entry.getKey(); Object value = entry.getValue(); if (value == null || value.equals("")) { throw new VmidcBrokerInvalidEntryException(field + " should not have an empty value."); } } }  }
ValidateUtil implements ValidationApi { public static void checkForNullFields(Map<String, Object> map) throws VmidcBrokerInvalidEntryException { for (Entry<String, Object> entry : map.entrySet()) { String field = entry.getKey(); Object value = entry.getValue(); if (value == null || value.equals("")) { throw new VmidcBrokerInvalidEntryException(field + " should not have an empty value."); } } }  static void checkForNullFields(Map<String, Object> map); static void validateFieldsAreNull(Map<String, Object> map); static void checkForValidIpAddressFormat(String ipAddress); static boolean validateDaName(String name); static void validateFieldLength(Map<String, String> map, int maxLen); static void checkForValidEmailAddress(String email); static void checkForValidUsername(String username); static void checkForValidPassword(String password); static void checkForValidFqdn(String smtpServer); static void checkForValidPortNumber(String port); static void checkMarkedForDeletion(IscEntity entity, String name); static boolean isEmpty(Collection<?> collection); @Override void checkValidIpAddress(String value); @Override void checkValidPassword(String value); @Override boolean isValidDaName(String string); }
ValidateUtil implements ValidationApi { public static void checkForNullFields(Map<String, Object> map) throws VmidcBrokerInvalidEntryException { for (Entry<String, Object> entry : map.entrySet()) { String field = entry.getKey(); Object value = entry.getValue(); if (value == null || value.equals("")) { throw new VmidcBrokerInvalidEntryException(field + " should not have an empty value."); } } }  static void checkForNullFields(Map<String, Object> map); static void validateFieldsAreNull(Map<String, Object> map); static void checkForValidIpAddressFormat(String ipAddress); static boolean validateDaName(String name); static void validateFieldLength(Map<String, String> map, int maxLen); static void checkForValidEmailAddress(String email); static void checkForValidUsername(String username); static void checkForValidPassword(String password); static void checkForValidFqdn(String smtpServer); static void checkForValidPortNumber(String port); static void checkMarkedForDeletion(IscEntity entity, String name); static boolean isEmpty(Collection<?> collection); @Override void checkValidIpAddress(String value); @Override void checkValidPassword(String value); @Override boolean isValidDaName(String string); static final int DEFAULT_MAX_LEN; }