public void testGet(JsonExampleResource example) throws ResourceException, IOException { System.out.println("---- testGet() ----"); JsonExampleResource newExample = JsonExampleResource.get(example.id, this); System.out.println(newExample); assertNotNull(newExample); assertEquals(example.message, newExample.message); testDelete(example); }
public void testUpdate(JsonExampleResource example) throws ResourceException, IOException { System.out.println("---- testUpdate() ----"); System.out.println(example); String newMessage = UUID.randomUUID().toString(); example.setMessage(newMessage, this); assertEquals(newMessage, example.message); System.out.println(example); testGet(example); }
@Test public void testCreate() throws IOException, ResourceException { System.out.println("---- testCreate() ----"); // create resource String message = UUID.randomUUID().toString(); JsonExampleResource example = JsonExampleResource.create(message, this); assertNotNull(example); assertEquals(message, example.message); System.out.println(example); // create nested resource long time = System.currentTimeMillis(); NestedJsonExampleResource nested = NestedJsonExampleResource.create(time, example, this); assertNotNull(nested); assertEquals(time, nested.value); System.out.println(nested); System.out.println(example); testUpdate(example); }
@Test public void testGetList() throws IOException, ResourceException { System.out.println("---- testGetList() ----"); List<JsonExampleResource> examples = JsonExampleResource.all(this); System.out.println(examples); }
public void testDelete(JsonExampleResource example) throws ResourceException, IOException { System.out.println("---- testDelete() ----"); assertTrue(example.getHandler().delete(this)); }