コード例 #1
0
  @Test
  public void testUpdate() throws Exception {
    URIRepository.save(test);
    test.setTarget("change");
    URIRepository.save(test);

    // Get the count
    long count = URIRepository.count();
    URIAvailable change = URIRepository.findByTarget(test.getTarget());
    assertEquals("change", change.getTarget());
  }
コード例 #2
0
  @Test
  public void testFindByTarget() throws Exception {
    URIRepository.save(test);

    // Checks that the saved URIAvailable is intact.
    URIAvailable url = URIRepository.findByTarget(test.getTarget());
    assertEquals(test, url);
  }
コード例 #3
0
  @Test
  public void testDelete() throws Exception {
    // Saves the test URIAvailable
    URIRepository.save(test);

    long count = URIRepository.count();

    // Count must be one.
    assertEquals(count, 1);

    // Delete the previously saved URIAvailable
    URIRepository.delete(test.getTarget());

    count = URIRepository.count();

    // Count must be zero.
    assertEquals(count, 0);
  }