### Question:
ValidateUtils { public static <T> void validate(T bean, Class<?>... groups) { validate(bean, true, groups); }  static void validate(T bean, Class<?>... groups); static void validate(T bean, boolean flag, Class<?>... groups);  }### Answer:
@Test public void testValidate() { User user = new User(); user.setRealName("a"); try { ValidateUtils.validate(user); } catch (Exception e) { String str = e.getMessage(); assertEquals(str, "用户id不能为空"); } }
@Test public void testFastValidate() { User user = new User(); try { ValidateUtils.validate(user, false); } catch (Exception e) { String str = e.getMessage(); String [] arrays = str.split(","); assertEquals(arrays.length, 2); } }
@Test public void testValidateSuccess() { User user = new User(); user.setId(1L); user.setRealName("a"); ValidateUtils.validate(user); }