@Test
public void testPostInstanceRefreshRequestUnknownAuthority() throws IOException {

    Path path = Paths.get("src/test/resources/valid.csr");
    String certCsr = new String(Files.readAllBytes(path));
    InstanceRefreshRequest req = new InstanceRefreshRequest().setCsr(certCsr);
    
    SimplePrincipal principal = (SimplePrincipal) SimplePrincipal.create("user", "kings",
            "v=U1,d=user;n=kings;s=sig", 0, new UserAuthority());
    ResourceContext context = createResourceContext(principal);
    try {
        zts.postInstanceRefreshRequest(context, "user", "kings", req);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 400);
    }
}