@Test public void transformation() { WikiReference wikiReference = new WikiReference("wiki"); assertEquals(wikiReference, onlyNameValidatorTestClass.transform(wikiReference)); wikiReference = new WikiReference("foo"); WikiReference transformedWikiReference = new WikiReference("bar"); assertEquals(transformedWikiReference, onlyNameValidatorTestClass.transform(wikiReference)); SpaceReference spaceReference = new SpaceReference("wiki", Arrays.asList("Space1", "Space2")); assertEquals(spaceReference, onlyNameValidatorTestClass.transform(spaceReference)); spaceReference = new SpaceReference("foo", Arrays.asList("Space1", "Space2")); SpaceReference transformedSpaceReference = new SpaceReference("bar", Arrays.asList("Space1", "Space2")); assertEquals(transformedSpaceReference, onlyNameValidatorTestClass.transform(spaceReference)); spaceReference = new SpaceReference("wiki", Arrays.asList("Space1", "foo")); transformedSpaceReference = new SpaceReference("wiki", Arrays.asList("Space1", "bar")); assertEquals(transformedSpaceReference, onlyNameValidatorTestClass.transform(spaceReference)); spaceReference = new SpaceReference("wiki", Arrays.asList("foo", "Space2")); transformedSpaceReference = new SpaceReference("wiki", Arrays.asList("bar", "Space2")); assertEquals(transformedSpaceReference, onlyNameValidatorTestClass.transform(spaceReference)); spaceReference = new SpaceReference("wiki", Arrays.asList("foo", "foo")); transformedSpaceReference = new SpaceReference("wiki", Arrays.asList("bar", "bar")); assertEquals(transformedSpaceReference, onlyNameValidatorTestClass.transform(spaceReference)); spaceReference = new SpaceReference("foo", Arrays.asList("Space1", "foo")); transformedSpaceReference = new SpaceReference("bar", Arrays.asList("Space1", "bar")); assertEquals(transformedSpaceReference, onlyNameValidatorTestClass.transform(spaceReference)); spaceReference = new SpaceReference("foo", Arrays.asList("foo", "foo")); transformedSpaceReference = new SpaceReference("bar", Arrays.asList("bar", "bar")); assertEquals(transformedSpaceReference, onlyNameValidatorTestClass.transform(spaceReference)); DocumentReference documentReference = new DocumentReference("wiki", Arrays.asList("Space1", "Space2"), "Page"); assertEquals(documentReference, onlyNameValidatorTestClass.transform(documentReference)); documentReference = new DocumentReference("wiki", Arrays.asList("Space1", "Space2"), "foo"); DocumentReference transformedDocumentReference = new DocumentReference("wiki", Arrays.asList("Space1", "Space2"), "bar"); assertEquals(transformedDocumentReference, onlyNameValidatorTestClass.transform(documentReference)); documentReference = new DocumentReference("wiki", Arrays.asList("Space1", "foo"), "Page"); transformedDocumentReference = new DocumentReference("wiki", Arrays.asList("Space1", "bar"), "Page"); assertEquals(transformedDocumentReference, onlyNameValidatorTestClass.transform(documentReference)); spaceReference = new SpaceReference("foo", Arrays.asList("Space1", "Space2")); Map<String, Serializable> parameters = new HashMap<>(); parameters.put("foo", "value"); parameters.put("key", "foo"); documentReference = new DocumentReference("foo", spaceReference, parameters); transformedSpaceReference = new SpaceReference("bar", Arrays.asList("Space1", "Space2")); transformedDocumentReference = new DocumentReference("bar", transformedSpaceReference, parameters); assertEquals(transformedDocumentReference, onlyNameValidatorTestClass.transform(documentReference)); documentReference = new DocumentReference("wiki", Arrays.asList("Space1", "foo"), "foo"); transformedDocumentReference = new DocumentReference("wiki", Arrays.asList("Space1", "bar"), "bar"); assertEquals(transformedDocumentReference, onlyNameValidatorTestClass.transform(documentReference)); documentReference = new DocumentReference("wiki", Arrays.asList("Space1", "Space2"), "Page"); AttachmentReference attachmentReference = new AttachmentReference("filename", documentReference); assertEquals(attachmentReference, onlyNameValidatorTestClass.transform(attachmentReference)); attachmentReference = new AttachmentReference("foo", documentReference); AttachmentReference transformedAttachmentReference = new AttachmentReference("bar", documentReference); assertEquals(transformedAttachmentReference, onlyNameValidatorTestClass.transform(attachmentReference)); documentReference = new DocumentReference("foo", Arrays.asList("Space1", "Space2"), "foo"); transformedDocumentReference = new DocumentReference("bar", Arrays.asList("Space1", "Space2"), "bar"); attachmentReference = new AttachmentReference("filename", documentReference); transformedAttachmentReference = new AttachmentReference("filename", transformedDocumentReference); assertEquals(transformedAttachmentReference, onlyNameValidatorTestClass.transform(attachmentReference)); }
@Override public EntityReference transform(EntityReference entityReference) { EntityReference parentReference = null; if (entityReference.getParent() != null) { parentReference = transform(entityReference.getParent()); } String newName = transform(entityReference.getName()); return new EntityReference(newName, entityReference.getType(), parentReference, entityReference.getParameters()); }
AbstractEntityNameValidation implements EntityNameValidation { @Override public EntityReference transform(EntityReference entityReference) { EntityReference parentReference = null; if (entityReference.getParent() != null) { parentReference = transform(entityReference.getParent()); } String newName = transform(entityReference.getName()); return new EntityReference(newName, entityReference.getType(), parentReference, entityReference.getParameters()); } }
AbstractEntityNameValidation implements EntityNameValidation { @Override public EntityReference transform(EntityReference entityReference) { EntityReference parentReference = null; if (entityReference.getParent() != null) { parentReference = transform(entityReference.getParent()); } String newName = transform(entityReference.getName()); return new EntityReference(newName, entityReference.getType(), parentReference, entityReference.getParameters()); }  }
AbstractEntityNameValidation implements EntityNameValidation { @Override public EntityReference transform(EntityReference entityReference) { EntityReference parentReference = null; if (entityReference.getParent() != null) { parentReference = transform(entityReference.getParent()); } String newName = transform(entityReference.getName()); return new EntityReference(newName, entityReference.getType(), parentReference, entityReference.getParameters()); }  @Override EntityReference transform(EntityReference entityReference); @Override boolean isValid(EntityReference entityReference); }
AbstractEntityNameValidation implements EntityNameValidation { @Override public EntityReference transform(EntityReference entityReference) { EntityReference parentReference = null; if (entityReference.getParent() != null) { parentReference = transform(entityReference.getParent()); } String newName = transform(entityReference.getName()); return new EntityReference(newName, entityReference.getType(), parentReference, entityReference.getParameters()); }  @Override EntityReference transform(EntityReference entityReference); @Override boolean isValid(EntityReference entityReference);  }