### Question:
DocumentUserReference implements UserReference { @Override public boolean isGlobal() { return this.entityReferenceProvider.getDefaultReference(EntityType.WIKI).equals( getReference().getWikiReference()); } DocumentUserReference(DocumentReference reference, EntityReferenceProvider entityReferenceProvider); DocumentReference getReference(); @Override boolean isGlobal(); @Override int hashCode(); @Override boolean equals(Object object); @Override String toString();  }### Answer:
@Test void isGlobalWhenTrue() { DocumentReference documentReference = new DocumentReference("mainwiki", "space", "page"); EntityReferenceProvider entityReferenceProvider = mock(EntityReferenceProvider.class); when(entityReferenceProvider.getDefaultReference(EntityType.WIKI)).thenReturn(new WikiReference("mainwiki")); DocumentUserReference userReference = new DocumentUserReference(documentReference, entityReferenceProvider); assertTrue(userReference.isGlobal()); }
@Test void isGlobalWhenFalse() { DocumentReference documentReference = new DocumentReference("wiki", "space", "page"); EntityReferenceProvider entityReferenceProvider = mock(EntityReferenceProvider.class); when(entityReferenceProvider.getDefaultReference(EntityType.WIKI)).thenReturn(new WikiReference("mainwiki")); DocumentUserReference userReference = new DocumentUserReference(documentReference, entityReferenceProvider); assertFalse(userReference.isGlobal()); }