Last change
on this file since 322 was
322,
checked in by hendrikvanantwerpen, 13 years ago
|
Added Play! framework and application with Jena dependency. Working on
the basic things now (login/register), after that start implementing
our data model.
|
File size:
1.1 KB
|
Line | |
---|
1 | import org.junit.*; |
---|
2 | |
---|
3 | import java.util.*; |
---|
4 | |
---|
5 | import play.mvc.*; |
---|
6 | import play.test.*; |
---|
7 | import play.libs.F.*; |
---|
8 | |
---|
9 | import static play.test.Helpers.*; |
---|
10 | import static org.fest.assertions.Assertions.*; |
---|
11 | |
---|
12 | import models.*; |
---|
13 | |
---|
14 | import com.avaje.ebean.*; |
---|
15 | |
---|
16 | public class ModelTest { |
---|
17 | |
---|
18 | private String formatted(Date date) { |
---|
19 | return new java.text.SimpleDateFormat("yyyy-MM-dd").format(date); |
---|
20 | } |
---|
21 | |
---|
22 | @Test |
---|
23 | public void findById() { |
---|
24 | running(fakeApplication(), new Runnable() { |
---|
25 | public void run() { |
---|
26 | Computer macintosh = Computer.find.byId(21l); |
---|
27 | assertThat(macintosh.name).isEqualTo("Macintosh"); |
---|
28 | assertThat(formatted(macintosh.introduced)).isEqualTo("1984-01-24"); |
---|
29 | } |
---|
30 | }); |
---|
31 | } |
---|
32 | |
---|
33 | @Test |
---|
34 | public void pagination() { |
---|
35 | running(fakeApplication(inMemoryDatabase()), new Runnable() { |
---|
36 | public void run() { |
---|
37 | Page<Computer> computers = Computer.page(1, 20, "name", "ASC", ""); |
---|
38 | assertThat(computers.getTotalRowCount()).isEqualTo(574); |
---|
39 | assertThat(computers.getList().size()).isEqualTo(20); |
---|
40 | } |
---|
41 | }); |
---|
42 | } |
---|
43 | |
---|
44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.