Ejemplo n.º 1
0
  @Test
  public void run() throws UnsupportedEncodingException {

    Person user = new Person();
    user.setUsername("Bob");
    user.setPassword("password");
    user.setGender(Gender.M);
    user.setPicture("picture".getBytes());
    user.setInfo("some info");

    user = repository.save(user);
    assertNotNull(user);
    assertEquals("picture", new String(user.getPicture(), "UTF-8"));

    user = repository.findOne(user.getId());
    assertNotNull(user);

    user.setInfo("other info");
    user = repository.save(user);
    assertNotNull(user);
    assertEquals("other info", user.getInfo());

    Iterable<Person> iter = repository.findAll();
    assertTrue(iter.iterator().hasNext());

    for (Person person : iter) {
      assertNotNull(person);
    }

    repository.delete(user);

    Person found = repository.findOne(user.getId());
    assertNull(found);
  }
Ejemplo n.º 2
0
 @Test
 @Ignore
 public void count() {
   assertTrue(repository.count() > 0);
 }