@Test public void should_ReturnValidationError_When_EmptyAsServiceNameGiven() { String validationResult = checker.check(""); assertNotNull(validationResult); assertTrue(validationResult.contains("blank")); }
public String check(String serviceName) { if (serviceName == null || serviceName.isEmpty()) { return "Service name cannot be blank"; } if (ECMA_SCRIPT_RESERVED_WORDS.contains(serviceName)) { return "Service name cannot be equal to JavaScript reserved words"; } if (CONTAINS_WHITESPACE_PATTERN.matcher(serviceName).matches()) { return "Service name cannot contain any whitespaces"; } return null; }
VaadinServiceNameChecker { public String check(String serviceName) { if (serviceName == null || serviceName.isEmpty()) { return "Service name cannot be blank"; } if (ECMA_SCRIPT_RESERVED_WORDS.contains(serviceName)) { return "Service name cannot be equal to JavaScript reserved words"; } if (CONTAINS_WHITESPACE_PATTERN.matcher(serviceName).matches()) { return "Service name cannot contain any whitespaces"; } return null; } }
VaadinServiceNameChecker { public String check(String serviceName) { if (serviceName == null || serviceName.isEmpty()) { return "Service name cannot be blank"; } if (ECMA_SCRIPT_RESERVED_WORDS.contains(serviceName)) { return "Service name cannot be equal to JavaScript reserved words"; } if (CONTAINS_WHITESPACE_PATTERN.matcher(serviceName).matches()) { return "Service name cannot contain any whitespaces"; } return null; }  }
VaadinServiceNameChecker { public String check(String serviceName) { if (serviceName == null || serviceName.isEmpty()) { return "Service name cannot be blank"; } if (ECMA_SCRIPT_RESERVED_WORDS.contains(serviceName)) { return "Service name cannot be equal to JavaScript reserved words"; } if (CONTAINS_WHITESPACE_PATTERN.matcher(serviceName).matches()) { return "Service name cannot contain any whitespaces"; } return null; }  String check(String serviceName); }
VaadinServiceNameChecker { public String check(String serviceName) { if (serviceName == null || serviceName.isEmpty()) { return "Service name cannot be blank"; } if (ECMA_SCRIPT_RESERVED_WORDS.contains(serviceName)) { return "Service name cannot be equal to JavaScript reserved words"; } if (CONTAINS_WHITESPACE_PATTERN.matcher(serviceName).matches()) { return "Service name cannot contain any whitespaces"; } return null; }  String check(String serviceName); static final Set<String> ECMA_SCRIPT_RESERVED_WORDS; }