Exemple #1
0
 @Test
 public void newTopic() {
   Forum test = new Forum("Test", "Yop");
   User guillaume = User.find("byName", "Guillaume").first();
   test.newTopic(guillaume, "Hello", "Yop ...");
   assertEquals(2L, (long) guillaume.getTopicsCount());
   assertEquals(1, test.topics.size());
   assertEquals(1, test.getTopicsCount());
   assertEquals(5, Topic.count());
 }
Exemple #2
0
 @Test
 public void testCascadeDelete() {
   Forum help = Forum.find("byName", "Play help").first();
   assertEquals(4, Topic.count());
   assertEquals(7, Post.count());
   help.delete();
   assertEquals(1, Topic.count());
   assertEquals(1, Post.count());
   User guillaume = User.find("byName", "Guillaume").first();
   assertEquals(0L, (long) guillaume.getTopicsCount());
 }
Exemple #3
0
  @Test
  public void createAndRetrieveUser() {
    // Create a new user and save it
    new User("*****@*****.**", "secret", "Bob").save();

    // Retrieve the user with e-mail address [email protected]
    User bob = User.find("byEmail", "*****@*****.**").first();

    // Test
    assertNotNull(bob);
    assertEquals("Bob", bob.fullname);
  }