@Test
public void deleteInstance_notFound() {

    new Expectations() {
        {
            config.getAppName();
            result = APP_NAME;
            factory.getInstance(APP_NAME, instanceInfo.getRegion(), NODE_ID);
            result = null;
        }
    };
    try {
        resource.getInstance(NODE_ID);
        fail("Expected WebApplicationException thrown");
    } catch (WebApplicationException e) {
        assertEquals(404, e.getResponse().getStatus());
        assertEquals(
                "No priam instance with id " + NODE_ID + " found", e.getResponse().getEntity());
    }
}