@Test
public void testGetUserTokenBadAuthority() {

    int code = 401;
    
    Authority principalAuthority = new com.yahoo.athenz.common.server.debug.DebugPrincipalAuthority();
    Principal principal = SimplePrincipal.create("user", "user1", "v=U1;d=user;n=user1;s=signature",
            0, principalAuthority);
    ResourceContext rsrcCtx1 = createResourceContext(principal);
    
    try {
        zms.getUserToken(rsrcCtx1, "user1", null, null);
        fail("unauthorizederror not thrown.");
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), code);
    }
}