@Test public void product_identifiers_too_long_returns_errormessage() { assertNotNull(validatorToTest.createValidationErrorMessage("123456789012345678901234567890x")); }
public String createValidationErrorMessage(String serverId) { if (serverId == null || serverId.trim().isEmpty()) { return "server identifier not set!"; } if (serverId.length() > 30) { return "server identifier length too big:" + serverId.length() + ", allowed is only 30"; } for (char c : serverId.toCharArray()) { if (Character.isAlphabetic(c)) { continue; } if (Character.isDigit(c)) { continue; } if (c == '_') { continue; } return "unexpected char inside server identifier found:" + c + ", allowed is only [a-zA-Z0-9_]"; } return null; }
PDSServerIdentifierValidator { public String createValidationErrorMessage(String serverId) { if (serverId == null || serverId.trim().isEmpty()) { return "server identifier not set!"; } if (serverId.length() > 30) { return "server identifier length too big:" + serverId.length() + ", allowed is only 30"; } for (char c : serverId.toCharArray()) { if (Character.isAlphabetic(c)) { continue; } if (Character.isDigit(c)) { continue; } if (c == '_') { continue; } return "unexpected char inside server identifier found:" + c + ", allowed is only [a-zA-Z0-9_]"; } return null; } }
PDSServerIdentifierValidator { public String createValidationErrorMessage(String serverId) { if (serverId == null || serverId.trim().isEmpty()) { return "server identifier not set!"; } if (serverId.length() > 30) { return "server identifier length too big:" + serverId.length() + ", allowed is only 30"; } for (char c : serverId.toCharArray()) { if (Character.isAlphabetic(c)) { continue; } if (Character.isDigit(c)) { continue; } if (c == '_') { continue; } return "unexpected char inside server identifier found:" + c + ", allowed is only [a-zA-Z0-9_]"; } return null; }  }
PDSServerIdentifierValidator { public String createValidationErrorMessage(String serverId) { if (serverId == null || serverId.trim().isEmpty()) { return "server identifier not set!"; } if (serverId.length() > 30) { return "server identifier length too big:" + serverId.length() + ", allowed is only 30"; } for (char c : serverId.toCharArray()) { if (Character.isAlphabetic(c)) { continue; } if (Character.isDigit(c)) { continue; } if (c == '_') { continue; } return "unexpected char inside server identifier found:" + c + ", allowed is only [a-zA-Z0-9_]"; } return null; }  String createValidationErrorMessage(String serverId); }
PDSServerIdentifierValidator { public String createValidationErrorMessage(String serverId) { if (serverId == null || serverId.trim().isEmpty()) { return "server identifier not set!"; } if (serverId.length() > 30) { return "server identifier length too big:" + serverId.length() + ", allowed is only 30"; } for (char c : serverId.toCharArray()) { if (Character.isAlphabetic(c)) { continue; } if (Character.isDigit(c)) { continue; } if (c == '_') { continue; } return "unexpected char inside server identifier found:" + c + ", allowed is only [a-zA-Z0-9_]"; } return null; }  String createValidationErrorMessage(String serverId);  }