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);  }
@Test public void testValidateUser_successful() { User user = new User("test-user"); RequestValidator.validateUser(user); }
@Test(expected = RuntimeException.class) public void testValidateUser_id_empty() throws IllegalArgumentException { User user = new User(""); RequestValidator.validateUser(user); }
@Test(expected = RuntimeException.class) public void testValidateUser_idContainsWhitespaces() throws IllegalArgumentException { User user = new User("test user"); RequestValidator.validateUser(user); }