EntityValidator { public void validateEntity(EntityDraft draft) { validateEntityLookupsReferences(draft); validateEntityLookupsFieldsReferences(draft); validateEntityComboboxFieldsSelectionTypesChanges(draft); validateEntityComboboxesValues(draft); }  void validateEntity(EntityDraft draft); void validateAdvancedSettingsEdit(Entity entity, String path); void validateFieldNotUsedByLookups(Entity entity, Long fieldId); @Autowired void setPersistenceManagerFactory(PersistenceManagerFactory persistenceManagerFactory); @Autowired void setBundleContext(BundleContext bundleContext);  }
@Test(expected = LookupReferencedException.class) public void shouldValidateEntityLookupFieldRemoval() { setupDataSource(); setupEntity(); setupDraftEntityForFieldRemoval(); entityValidator.validateEntity(draft); }
@Test(expected = LookupReferencedException.class) public void shouldValidateEntityLookupFieldAddition() { setupDataSource(); setupEntity(); setupDraftEntityForFieldAddition(); entityValidator.validateEntity(draft); }
@Test(expected = LookupReferencedException.class) public void shouldValidateEntityLookupChange() { setupDataSource(); setupEntity(); setupDraftEntityForLookupChange(); entityValidator.validateEntity(draft); }
@Test(expected = IncompatibleComboboxFieldException.class) public void shouldValidateComboboxFieldChangeL() { setupPersistenceManager(); setupEntity(); setupBaseDraft(); setupDraftEntityForComboboxChange(); entityValidator.validateEntity(draft); }
@Test(expected = UserSuppliedComboboxValuesUsedException.class) public void shouldValidateEntitySingleSelectComboboxValues() { setupPersistenceManager(); setupPersistenceManagerAsMySQL(); setupEntity(); setupBaseDraft(); setupDraftEntityForComboboxFieldValidation(); setupSingleSelectFieldChange(); entityValidator.validateEntity(draft); }
@Test(expected = UserSuppliedComboboxValuesUsedException.class) public void shouldValidateEntityMultiSelectComboboxValues() { setupPersistenceManager(); setupPersistenceManagerAsMySQL(); setupEntity(); setupBaseDraft(); setupDraftEntityForComboboxFieldValidation(); setupMultiSelectFieldChange(); entityValidator.validateEntity(draft); }