@Test public void transformName() { when(nameStrategyManager.getEntityReferenceNameStrategy()).thenReturn(nameStrategy); when(configuration.useTransformation()).thenReturn(true); assertEquals(TRANSFORMED_NAME, scriptService.transformName(TEST_NAME)); verify(nameStrategy, times(1)).transform(TEST_NAME); when(nameStrategyManager.getEntityReferenceNameStrategy()).thenReturn(null); assertEquals(TEST_NAME, scriptService.transformName(TEST_NAME)); verify(nameStrategy, times(1)).transform(TEST_NAME); when(nameStrategyManager.getEntityReferenceNameStrategy()).thenReturn(nameStrategy); when(configuration.useTransformation()).thenReturn(false); assertEquals(TEST_NAME, scriptService.transformName(TEST_NAME)); verify(nameStrategy, times(1)).transform(TEST_NAME); when(nameStrategyManager.getEntityReferenceNameStrategy()).thenReturn(null); when(configuration.useTransformation()).thenReturn(false); assertEquals(TEST_NAME, scriptService.transformName(TEST_NAME)); verify(nameStrategy, times(1)).transform(TEST_NAME); }
public String transformName(String name) { if (this.entityNameValidationConfiguration.useTransformation() && this.entityNameValidationManager.getEntityReferenceNameStrategy() != null) { return this.entityNameValidationManager.getEntityReferenceNameStrategy().transform(name); } else { return name; } }
ModelValidationScriptService implements ScriptService { public String transformName(String name) { if (this.entityNameValidationConfiguration.useTransformation() && this.entityNameValidationManager.getEntityReferenceNameStrategy() != null) { return this.entityNameValidationManager.getEntityReferenceNameStrategy().transform(name); } else { return name; } } }
ModelValidationScriptService implements ScriptService { public String transformName(String name) { if (this.entityNameValidationConfiguration.useTransformation() && this.entityNameValidationManager.getEntityReferenceNameStrategy() != null) { return this.entityNameValidationManager.getEntityReferenceNameStrategy().transform(name); } else { return name; } }  }
ModelValidationScriptService implements ScriptService { public String transformName(String name) { if (this.entityNameValidationConfiguration.useTransformation() && this.entityNameValidationManager.getEntityReferenceNameStrategy() != null) { return this.entityNameValidationManager.getEntityReferenceNameStrategy().transform(name); } else { return name; } }  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 String transformName(String name) { if (this.entityNameValidationConfiguration.useTransformation() && this.entityNameValidationManager.getEntityReferenceNameStrategy() != null) { return this.entityNameValidationManager.getEntityReferenceNameStrategy().transform(name); } else { return name; } }  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);  }