@Test public void isValid() { WikiReference wikiReference = new WikiReference("wiki"); assertTrue(onlyNameValidatorTestClass.isValid(wikiReference)); wikiReference = new WikiReference("foo"); assertFalse(onlyNameValidatorTestClass.isValid(wikiReference)); SpaceReference spaceReference = new SpaceReference("wiki", Arrays.asList("Space1", "Space2")); assertTrue(onlyNameValidatorTestClass.isValid(spaceReference)); spaceReference = new SpaceReference("foo", Arrays.asList("Space1", "Space2")); assertFalse(onlyNameValidatorTestClass.isValid(spaceReference)); spaceReference = new SpaceReference("wiki", Arrays.asList("Space1", "foo")); assertFalse(onlyNameValidatorTestClass.isValid(spaceReference)); spaceReference = new SpaceReference("wiki", Arrays.asList("foo", "Space2")); assertFalse(onlyNameValidatorTestClass.isValid(spaceReference)); spaceReference = new SpaceReference("wiki", Arrays.asList("foo", "foo")); assertFalse(onlyNameValidatorTestClass.isValid(spaceReference)); spaceReference = new SpaceReference("foo", Arrays.asList("Space1", "foo")); assertFalse(onlyNameValidatorTestClass.isValid(spaceReference)); spaceReference = new SpaceReference("foo", Arrays.asList("foo", "foo")); assertFalse(onlyNameValidatorTestClass.isValid(spaceReference)); spaceReference = new SpaceReference("bar", Arrays.asList("Space1", "Space2")); assertTrue(onlyNameValidatorTestClass.isValid(spaceReference)); spaceReference = new SpaceReference("wiki", Arrays.asList("Space1", "bar")); assertTrue(onlyNameValidatorTestClass.isValid(spaceReference)); spaceReference = new SpaceReference("wiki", Arrays.asList("bar", "Space2")); assertTrue(onlyNameValidatorTestClass.isValid(spaceReference)); spaceReference = new SpaceReference("wiki", Arrays.asList("bar", "bar")); assertTrue(onlyNameValidatorTestClass.isValid(spaceReference)); spaceReference = new SpaceReference("bar", Arrays.asList("Space1", "bar")); assertTrue(onlyNameValidatorTestClass.isValid(spaceReference)); spaceReference = new SpaceReference("bar", Arrays.asList("bar", "bar")); assertTrue(onlyNameValidatorTestClass.isValid(spaceReference)); DocumentReference documentReference = new DocumentReference("wiki", Arrays.asList("Space1", "Space2"), "Page"); assertTrue(onlyNameValidatorTestClass.isValid(documentReference)); documentReference = new DocumentReference("wiki", Arrays.asList("Space1", "Space2"), "foo"); assertFalse(onlyNameValidatorTestClass.isValid(documentReference)); documentReference = new DocumentReference("wiki", Arrays.asList("Space1", "foo"), "Page"); assertFalse(onlyNameValidatorTestClass.isValid(documentReference)); documentReference = new DocumentReference("wiki", Arrays.asList("Space1", "Space2"), "bar"); assertTrue(onlyNameValidatorTestClass.isValid(documentReference)); documentReference = new DocumentReference("wiki", Arrays.asList("Space1", "bar"), "Page"); assertTrue(onlyNameValidatorTestClass.isValid(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); assertFalse(onlyNameValidatorTestClass.isValid(documentReference)); spaceReference = new SpaceReference("bar", Arrays.asList("Space1", "Space2")); documentReference = new DocumentReference("bar", spaceReference, parameters); assertTrue(onlyNameValidatorTestClass.isValid(documentReference)); documentReference = new DocumentReference("wiki", Arrays.asList("Space1", "foo"), "foo"); assertFalse(onlyNameValidatorTestClass.isValid(documentReference)); documentReference = new DocumentReference("wiki", Arrays.asList("Space1", "bar"), "bar"); assertTrue(onlyNameValidatorTestClass.isValid(documentReference)); documentReference = new DocumentReference("wiki", Arrays.asList("Space1", "Space2"), "Page"); AttachmentReference attachmentReference = new AttachmentReference("filename", documentReference); assertTrue(onlyNameValidatorTestClass.isValid(attachmentReference)); attachmentReference = new AttachmentReference("foo", documentReference); assertFalse(onlyNameValidatorTestClass.isValid(attachmentReference)); documentReference = new DocumentReference("foo", Arrays.asList("Space1", "Space2"), "foo"); attachmentReference = new AttachmentReference("filename", documentReference); assertFalse(onlyNameValidatorTestClass.isValid(attachmentReference)); documentReference = new DocumentReference("bar", Arrays.asList("Space1", "Space2"), "bar"); attachmentReference = new AttachmentReference("bar", documentReference); assertTrue(onlyNameValidatorTestClass.isValid(attachmentReference)); documentReference = new DocumentReference("bar", Arrays.asList("Space1", "Space2"), "bar"); attachmentReference = new AttachmentReference("filename", documentReference); assertTrue(onlyNameValidatorTestClass.isValid(attachmentReference)); }
@Override public boolean isValid(EntityReference entityReference) { if (entityReference == null) { return true; } return isValid(entityReference.getParent()) && isValid(entityReference.getName()); }
AbstractEntityNameValidation implements EntityNameValidation { @Override public boolean isValid(EntityReference entityReference) { if (entityReference == null) { return true; } return isValid(entityReference.getParent()) && isValid(entityReference.getName()); } }
AbstractEntityNameValidation implements EntityNameValidation { @Override public boolean isValid(EntityReference entityReference) { if (entityReference == null) { return true; } return isValid(entityReference.getParent()) && isValid(entityReference.getName()); }  }
AbstractEntityNameValidation implements EntityNameValidation { @Override public boolean isValid(EntityReference entityReference) { if (entityReference == null) { return true; } return isValid(entityReference.getParent()) && isValid(entityReference.getName()); }  @Override EntityReference transform(EntityReference entityReference); @Override boolean isValid(EntityReference entityReference); }
AbstractEntityNameValidation implements EntityNameValidation { @Override public boolean isValid(EntityReference entityReference) { if (entityReference == null) { return true; } return isValid(entityReference.getParent()) && isValid(entityReference.getName()); }  @Override EntityReference transform(EntityReference entityReference); @Override boolean isValid(EntityReference entityReference);  }