### Question:
SecurityContext implements AutoCloseable { public UUID getCurrentUserID() { try { return identityResolver.resolveSubjectUUID(accessController.validate(credentials)); } catch (InvalidCredentialsException ex) { throw new UnexpectedAuthenticationFailedException("Could not authenticate user: " + ex.getMessage()); } } protected  SecurityContext(AccessController accessController, IdentityResolver identityResolver, Credentials credentials); static SecurityContext get(); static SecurityContext set(SecurityContext ctx); static boolean isSet(); static SecurityContext clear(); @Override void close(); Credentials getCredentials(); void checkPermission(NamedFunction function); void checkPermission(NamedFunction function, UUID organizationID); UUID getCurrentUserID(); Set<UUID> getAvailableOrganizationID();  }### Answer:
@Test public void testGetCurrentUserID() throws Exception { UUID currentUserID = UUID.fromString("00000000-0000-0000-0000-000000000001"); when(accessController.validate(credentials)).thenReturn(sessionDescriptor); when(identityResolver.resolveSubjectUUID(sessionDescriptor)).thenReturn(currentUserID); assertEquals(currentUserID, context.getCurrentUserID()); }
@Test(expected = UnexpectedAuthenticationFailedException.class) public void testGetCurrentUserIdThrowsUnexpectedAuthenticationFailedException() throws Exception { when(accessController.validate(credentials)).thenThrow(InvalidCredentialsException.class); context.getCurrentUserID(); }