### Question:
PropertiesBasedIdentityResolver implements IdentityResolver { @Override public UUID resolveSubjectUUID(SubjectIdentity identity) { if (!(identity instanceof SubjectIdentifier)) { throw new IllegalArgumentException("Cannot handle the type of provided identity."); } return SubjectIdentifier.class.cast(identity).getGlobalID(); }  @Override FunctionIdentity resolveFunctionIdentity(String name); @Override OrganizationIdentity resolveOrganizationIdentity(UUID id); @Override UUID resolveOrganizationUUID(OrganizationIdentity identity); @Override SubjectIdentity resolveSubjectIdentity(UUID id); @Override UUID resolveSubjectUUID(SubjectIdentity identity); @Override UUID resolveSubjectUUID(SessionDescriptor descriptor);  }### Answer:
@Test public void testResolveSubjectUUID() { UUID id = UUID.fromString("00000000-0000-0000-0000-000000000001"); SubjectIdentity identity = SubjectIdentifier.builder().setGlobalID(id).build(); assertEquals(id, resolver.resolveSubjectUUID(identity)); }
@Test(expected = IllegalArgumentException.class) public void testResolveSubjectUuidWithWrongIdentityType() { resolver.resolveSubjectUUID(new SubjectIdentity() {}); }
@Test public void testResolveSubjectUuidFromSessionDescriptor() { UUID id = UUID.fromString("00000000-0000-0000-0000-000000000001"); SubjectIdentifier identifier = SubjectIdentifier.builder().setGlobalID(id).build(); SessionDescriptor descriptor = SubjectDescriptor.builder().setIdentifier(identifier).build(); assertEquals(id, resolver.resolveSubjectUUID(descriptor)); }
@Test(expected = IllegalArgumentException.class) public void testResolveSubjectUuidFromSessionDescriptorWithWrongDescriptorType() { resolver.resolveSubjectUUID(new SessionDescriptor() {}); }