@Test public void shouldGiveErrorIfRoleDoesNotHaveAnyName() throws Exception { Role role = new Role("", "description", asList(new Right(CREATE_REQUISITION, RightType.REQUISITION))); expectedEx.expect(dataExceptionMatcher("error.role.without.name")); role.validate(); role.setName(null); expectedEx.expect(dataExceptionMatcher("error.role.without.name")); role.validate(); }
public void validate() { if (isBlank(name)) throw new DataException("error.role.without.name"); if (rights == null || rights.isEmpty()) throw new DataException("error.role.without.rights"); validateForRelatedRights(); }
Role extends BaseModel { public void validate() { if (isBlank(name)) throw new DataException("error.role.without.name"); if (rights == null || rights.isEmpty()) throw new DataException("error.role.without.rights"); validateForRelatedRights(); } }
Role extends BaseModel { public void validate() { if (isBlank(name)) throw new DataException("error.role.without.name"); if (rights == null || rights.isEmpty()) throw new DataException("error.role.without.rights"); validateForRelatedRights(); } Role(String name, String description); }
Role extends BaseModel { public void validate() { if (isBlank(name)) throw new DataException("error.role.without.name"); if (rights == null || rights.isEmpty()) throw new DataException("error.role.without.rights"); validateForRelatedRights(); } Role(String name, String description); void validate(); }
Role extends BaseModel { public void validate() { if (isBlank(name)) throw new DataException("error.role.without.name"); if (rights == null || rights.isEmpty()) throw new DataException("error.role.without.rights"); validateForRelatedRights(); } Role(String name, String description); void validate();  }