### Question:
GrantResource implements IResource { @Override public boolean exists() { return wrappedResource == null || wrappedResource.exists(); } private  GrantResource(IResource wrappedResource); static GrantResource fromResource(IResource resource); static GrantResource root(); @Override String getName(); @Override IResource getParent(); @Override boolean hasParent(); @Override boolean exists(); @Override Set<Permission> applicablePermissions(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void testExists() { IResource wrappedResourceMock = mock(IResource.class); when(wrappedResourceMock.exists()).thenReturn(true, false); GrantResource resource = GrantResource.fromResource(wrappedResourceMock); assertThat(resource.exists()).isTrue(); assertThat(resource.exists()).isFalse(); }