コード例 #1
0
  @Override
  public void validate_User_Name() {
    final User entity = getUser();

    entity.setName(null);
    final ValidationResult<User> result = validator.validate(entity);
    assertTrue(result.containsId("USR501.FR"));
  }
コード例 #2
0
  @Override
  public void validate_User_Number() {
    final User entity = getUser();

    // null
    entity.setNumber(null);
    ValidationResult<User> result = validator.validate(entity);
    assertTrue(result.isOk());

    // regex
    entity.setNumber("X0");
    result = validator.validate(entity);
    assertEquals(1, result.size());
    assertTrue(result.containsId("USR003.FR"));

    entity.setNumber(entity.getNumber().toLowerCase());
    result = validator.validate(entity);
    assertEquals(1, result.size());
    assertTrue(result.containsId("USR003.FR"));
  }