Esempio n. 1
0
  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);
  }
Esempio n. 2
0
  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);
  }
Esempio n. 3
0
  @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);
  }
Esempio n. 4
0
 @Test
 public void testGetList() throws IOException, ResourceException {
   System.out.println("---- testGetList() ----");
   List<JsonExampleResource> examples = JsonExampleResource.all(this);
   System.out.println(examples);
 }
Esempio n. 5
0
 public void testDelete(JsonExampleResource example) throws ResourceException, IOException {
   System.out.println("---- testDelete() ----");
   assertTrue(example.getHandler().delete(this));
 }