@Test
public void testGetUserTokenInvalidAuthorizedService() {

    
    Authority userAuthority = new com.yahoo.athenz.common.server.debug.DebugUserAuthority();
    
    String userId = "george";
    Principal principal = SimplePrincipal.create("user", userId, userId + ":password",
            0, userAuthority);
    assertNotNull(principal);
    ((SimplePrincipal) principal).setUnsignedCreds(userId);
    ResourceContext rsrcCtx1 = createResourceContext(principal);
    
    try {
        zms.getUserToken(rsrcCtx1, userId, "coretech.storage,sports", null);
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 401);
        assertTrue(ex.getMessage().contains("getUserToken: Service sports is not authorized in ZMS"));
    }
    try {
        zms.getUserToken(rsrcCtx1, userId, "baseball", false);
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 401);
        assertTrue(ex.getMessage().contains("getUserToken: Service baseball is not authorized in ZMS"));
    }
    
    try {
        zms.getUserToken(rsrcCtx1, userId, "hat trick", false);
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 401);
        assertTrue(ex.getMessage().contains("getUserToken: Service hat trick is not authorized in ZMS"));
    }
}