File tmpFile = File.createTempFile("parser_json_test", ".json");
tmpFile.deleteOnExit();
JsonObject jsonObject = Json.createObjectBuilder().add("firstName", "George").add("lastName", "Gastaldi").build();
Resource<File> resource = resourceFactory.create(tmpFile);
Assert.assertThat(resource, CoreMatchers.instanceOf(JsonResource.class));
JsonResource jsonResource = resource.reify(JsonResource.class);
jsonResource.setContents(jsonObject);
jsonObject = jsonResource.getJsonObject();
Assert.assertNotNull(jsonObject);
Assert.assertEquals("George", jsonObject.getString("firstName"));
Assert.assertEquals("Gastaldi", jsonObject.getString("lastName"));
}