@Test(expected = RuntimeException.class) public void testValidateUser_idContainsWhitespaces() throws IllegalArgumentException { User user = new User("test user"); RequestValidator.validateUser(user); }
public static void validateUser(User user) { Assert.notNull(user, "subscription user can't null"); Assert.isTrue(!StringUtils.isEmpty(user.getId()), "subscription userId can't empty"); Assert.isTrue(!StringUtils.containsWhitespace(user.getId()), "subscription userId can't contain whitespaces"); }
RequestValidator { public static void validateUser(User user) { Assert.notNull(user, "subscription user can't null"); Assert.isTrue(!StringUtils.isEmpty(user.getId()), "subscription userId can't empty"); Assert.isTrue(!StringUtils.containsWhitespace(user.getId()), "subscription userId can't contain whitespaces"); } }
RequestValidator { public static void validateUser(User user) { Assert.notNull(user, "subscription user can't null"); Assert.isTrue(!StringUtils.isEmpty(user.getId()), "subscription userId can't empty"); Assert.isTrue(!StringUtils.containsWhitespace(user.getId()), "subscription userId can't contain whitespaces"); }  }
RequestValidator { public static void validateUser(User user) { Assert.notNull(user, "subscription user can't null"); Assert.isTrue(!StringUtils.isEmpty(user.getId()), "subscription userId can't empty"); Assert.isTrue(!StringUtils.containsWhitespace(user.getId()), "subscription userId can't contain whitespaces"); }  static void validateUser(User user); static void validateExpression(Expression expression); static void validateBoolean(Boolean condition); static void validateMappingDetector(ConsumerDetectorMapping consumerDetectorMapping); static void validateDetectorDocument(DetectorDocument document); static void validateDetector(Detector detector); }
RequestValidator { public static void validateUser(User user) { Assert.notNull(user, "subscription user can't null"); Assert.isTrue(!StringUtils.isEmpty(user.getId()), "subscription userId can't empty"); Assert.isTrue(!StringUtils.containsWhitespace(user.getId()), "subscription userId can't contain whitespaces"); }  static void validateUser(User user); static void validateExpression(Expression expression); static void validateBoolean(Boolean condition); static void validateMappingDetector(ConsumerDetectorMapping consumerDetectorMapping); static void validateDetectorDocument(DetectorDocument document); static void validateDetector(Detector detector);  }