### Question:
SecurityContext implements AutoCloseable { public Set<UUID> getAvailableOrganizationID() { try { Set<OrganizationIdentity> organizations = accessController.getAvailableOrganizations(credentials); return organizations.stream() .map(identityResolver::resolveOrganizationUUID) .collect(Collectors.toSet()); } 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 testGetAvailableOrganizationID() throws Exception { UUID organizationID = UUID.fromString("00000000-0000-0000-0000-000000000001"); when(accessController.getAvailableOrganizations(credentials)).thenReturn(SetUtils.set(organization)); when(identityResolver.resolveOrganizationUUID(organization)).thenReturn(organizationID); assertEquals(SetUtils.set(organizationID), context.getAvailableOrganizationID()); }
@Test(expected = UnexpectedAuthenticationFailedException.class) public void testGetAvailableOrganizationIdThrowsUnexpectedAuthenticationFailedException() throws Exception { when(accessController.getAvailableOrganizations(credentials)).thenThrow(InvalidCredentialsException.class); context.getAvailableOrganizationID(); }