Skip to content

Commit

Permalink
Added more unit tests to get code-coverage closer to 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
phonadex committed Jul 26, 2011
1 parent 526196a commit a14d3fc
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/ApplicationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,13 @@ public void testThatIndexPageWorks() {
assertCharset("utf-8", response);
}

@Test
public void testBorrowBook() {
Response response = GET("/Application/borrowBook?bookId=1");
assertNotNull(response);
//assertIsOk(response);
//assertContentType("text/html", response);
//assertCharset("utf-8", response);
}

}
17 changes: 17 additions & 0 deletions test/BookTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import org.junit.*;
import java.util.*;
import play.test.*;
import controllers.*;
import models.*;

public class BookTest extends UnitTest {

@Test
public void constructorTest() {
Book b = new Book("Title", "Author");
assertFalse(b.isCheckedOut);
b.checkOut();
assertTrue(b.isCheckedOut);
}

}
24 changes: 24 additions & 0 deletions test/BootstrapTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import org.junit.*;
import java.util.*;
import play.test.*;
import controllers.*;
import models.*;
import jobs.*;

public class BootstrapTest extends UnitTest {

@Test
public void doJobNoBooks() {
Bootstrap job = new Bootstrap();
job.doJob();
}

@Test
public void doJobWithBooks() {
Book b = new Book("Title", "Author");
b.save();
Bootstrap job = new Bootstrap();
job.doJob();
}

}

0 comments on commit a14d3fc

Please sign in to comment.