Commit 2cb389a34ca4ec3190a676e98687db068e58a3e3
1 parent
e5584575
Exists in
master
Adição de testes
Showing
1 changed file
with
18 additions
and
3 deletions
Show diff stats
impl/extension/jpa/src/test/java/template/JPACrudTest.java
... | ... | @@ -4,11 +4,14 @@ import static junit.framework.Assert.assertEquals; |
4 | 4 | import static junit.framework.Assert.assertNotNull; |
5 | 5 | import static junit.framework.Assert.assertNull; |
6 | 6 | |
7 | +import java.util.List; | |
8 | + | |
7 | 9 | import javax.inject.Inject; |
8 | 10 | |
9 | 11 | import org.jboss.arquillian.container.test.api.Deployment; |
10 | 12 | import org.jboss.arquillian.junit.Arquillian; |
11 | 13 | import org.jboss.shrinkwrap.api.spec.WebArchive; |
14 | +import org.junit.Before; | |
12 | 15 | import org.junit.Test; |
13 | 16 | import org.junit.runner.RunWith; |
14 | 17 | |
... | ... | @@ -30,9 +33,11 @@ public class JPACrudTest { |
30 | 33 | return deployment; |
31 | 34 | } |
32 | 35 | |
33 | - @Test | |
34 | - public void x() { | |
35 | - | |
36 | + @Before | |
37 | + public void eraseData() { | |
38 | + for(MyEntity myEntity : crud.findAll()) { | |
39 | + crud.delete(myEntity.getId()); | |
40 | + } | |
36 | 41 | } |
37 | 42 | |
38 | 43 | @Test |
... | ... | @@ -66,6 +71,16 @@ public class JPACrudTest { |
66 | 71 | assertEquals("update example", persisted.getDescription()); |
67 | 72 | } |
68 | 73 | |
74 | + @Test | |
75 | + public void findAll() { | |
76 | + populate(4, 0); | |
77 | + | |
78 | + List<MyEntity> list; | |
79 | + list = crud.findAll(); | |
80 | + | |
81 | + assertEquals(list.size(), 4); | |
82 | + } | |
83 | + | |
69 | 84 | private void populate(int size, int offset) { |
70 | 85 | MyEntity entity; |
71 | 86 | ... | ... |