@Test public void isValidEntityReferenceWithHint() { when(nameStrategyManager.getEntityReferenceNameStrategy(HINT)).thenReturn(nameStrategy); when(configuration.useValidation()).thenReturn(false); assertFalse(scriptService.isValid(entityReferenceSource, HINT)); verify(nameStrategy, times(1)).isValid(entityReferenceSource); verify(nameStrategyManager, never()).getEntityReferenceNameStrategy(); when(nameStrategyManager.getEntityReferenceNameStrategy(HINT)).thenReturn(null); when(configuration.useValidation()).thenReturn(false); assertTrue(scriptService.isValid(entityReferenceSource, HINT)); verify(nameStrategy, times(1)).isValid(entityReferenceSource); verify(nameStrategyManager, never()).getEntityReferenceNameStrategy(); when(nameStrategyManager.getEntityReferenceNameStrategy(HINT)).thenReturn(nameStrategy); when(configuration.useValidation()).thenReturn(true); assertFalse(scriptService.isValid(entityReferenceSource, HINT)); verify(nameStrategy, times(2)).isValid(entityReferenceSource); verify(nameStrategyManager, never()).getEntityReferenceNameStrategy(); when(nameStrategyManager.getEntityReferenceNameStrategy(HINT)).thenReturn(null); when(configuration.useValidation()).thenReturn(true); assertTrue(scriptService.isValid(entityReferenceSource, HINT)); verify(nameStrategy, times(2)).isValid(entityReferenceSource); verify(nameStrategyManager, never()).getEntityReferenceNameStrategy(); }
public boolean isValid(String name) { if (this.entityNameValidationConfiguration.useValidation() && this.entityNameValidationManager.getEntityReferenceNameStrategy() != null) { return this.entityNameValidationManager.getEntityReferenceNameStrategy().isValid(name); } else { return true; } }
ModelValidationScriptService implements ScriptService { public boolean isValid(String name) { if (this.entityNameValidationConfiguration.useValidation() && this.entityNameValidationManager.getEntityReferenceNameStrategy() != null) { return this.entityNameValidationManager.getEntityReferenceNameStrategy().isValid(name); } else { return true; } } }
ModelValidationScriptService implements ScriptService { public boolean isValid(String name) { if (this.entityNameValidationConfiguration.useValidation() && this.entityNameValidationManager.getEntityReferenceNameStrategy() != null) { return this.entityNameValidationManager.getEntityReferenceNameStrategy().isValid(name); } else { return true; } }  }
ModelValidationScriptService implements ScriptService { public boolean isValid(String name) { if (this.entityNameValidationConfiguration.useValidation() && this.entityNameValidationManager.getEntityReferenceNameStrategy() != null) { return this.entityNameValidationManager.getEntityReferenceNameStrategy().isValid(name); } else { return true; } }  EntityNameValidationManager getManager(); EntityNameValidationConfiguration getConfiguration(); ReplaceCharacterEntityNameValidationConfiguration getReplaceCharacterEntityNameValidationConfiguration(); String transformName(String name); EntityReference transformEntityReference(EntityReference sourceEntity); String transformName(String name, String hint); EntityReference transformEntityReference(EntityReference sourceEntity, String hint); boolean isValid(String name); boolean isValid(EntityReference sourceEntity); boolean isValid(String name, String hint); boolean isValid(EntityReference sourceEntity, String hint); }
ModelValidationScriptService implements ScriptService { public boolean isValid(String name) { if (this.entityNameValidationConfiguration.useValidation() && this.entityNameValidationManager.getEntityReferenceNameStrategy() != null) { return this.entityNameValidationManager.getEntityReferenceNameStrategy().isValid(name); } else { return true; } }  EntityNameValidationManager getManager(); EntityNameValidationConfiguration getConfiguration(); ReplaceCharacterEntityNameValidationConfiguration getReplaceCharacterEntityNameValidationConfiguration(); String transformName(String name); EntityReference transformEntityReference(EntityReference sourceEntity); String transformName(String name, String hint); EntityReference transformEntityReference(EntityReference sourceEntity, String hint); boolean isValid(String name); boolean isValid(EntityReference sourceEntity); boolean isValid(String name, String hint); boolean isValid(EntityReference sourceEntity, String hint);  }