@Test public void shouldNotThrowExceptionIfParentNotGivenToRootLevelGeoZone() throws Exception { GeographicLevel rootLevel = new GeographicLevel(1234L, "non root level", "non root level", 1); GeographicZone geographicZone = new GeographicZone(1234L, "some level", "some level", rootLevel, null); geographicZone.validateLevel(); }
@JsonIgnore public void validateLevel() { if (this.getLevel() == null) throw new DataException("error.geo.level.invalid"); validateLevelAndParentAssociation(); }
GeographicZone extends BaseModel implements Importable { @JsonIgnore public void validateLevel() { if (this.getLevel() == null) throw new DataException("error.geo.level.invalid"); validateLevelAndParentAssociation(); } }
GeographicZone extends BaseModel implements Importable { @JsonIgnore public void validateLevel() { if (this.getLevel() == null) throw new DataException("error.geo.level.invalid"); validateLevelAndParentAssociation(); } GeographicZone(Long id, String code, String name, GeographicLevel level, GeographicZone parent); }
GeographicZone extends BaseModel implements Importable { @JsonIgnore public void validateLevel() { if (this.getLevel() == null) throw new DataException("error.geo.level.invalid"); validateLevelAndParentAssociation(); } GeographicZone(Long id, String code, String name, GeographicLevel level, GeographicZone parent); @JsonIgnore boolean isParentHigherInHierarchy(); @JsonIgnore boolean isRootLevel(); @JsonIgnore void validateLevel(); @JsonIgnore void validateParentIsHigherInHierarchy(); @JsonIgnore void validateParentExists(); void validateMandatoryFields(); }
GeographicZone extends BaseModel implements Importable { @JsonIgnore public void validateLevel() { if (this.getLevel() == null) throw new DataException("error.geo.level.invalid"); validateLevelAndParentAssociation(); } GeographicZone(Long id, String code, String name, GeographicLevel level, GeographicZone parent); @JsonIgnore boolean isParentHigherInHierarchy(); @JsonIgnore boolean isRootLevel(); @JsonIgnore void validateLevel(); @JsonIgnore void validateParentIsHigherInHierarchy(); @JsonIgnore void validateParentExists(); void validateMandatoryFields();  }