@Test
public void testPostInstanceRegisterInformationNoAuthorizedProvider() throws IOException {

    ChangeLogStore structStore = new ZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root",
            privateKey, "0");
    
    DataStore store = new DataStore(structStore, null);
    ZTSImpl ztsImpl = new ZTSImpl(mockCloudStore, store);
    
    SignedDomain providerDomain = signedAuthorizedProviderDomain();
    store.processDomain(providerDomain, false);
    
    SignedDomain tenantDomain = signedBootstrapTenantDomain("athenz.provider", "athenz", "production");
    store.processDomain(tenantDomain, false);
    
    Path path = Paths.get("src/test/resources/athenz.instanceid.csr");
    String certCsr = new String(Files.readAllBytes(path));
    
    InstanceRegisterInformation info = new InstanceRegisterInformation()
            .setAttestationData("attestationData").setCsr(certCsr)
            .setDomain("athenz").setService("production")
            .setProvider("athenz.nonprovider");
    
    ResourceContext context = createResourceContext(null);
    try {
        ztsImpl.postInstanceRegisterInformation(context, info);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 403);
        assertTrue(ex.getMessage().contains("not authorized to launch instances in Athenz"));
    }
}