From 2cb389a34ca4ec3190a676e98687db068e58a3e3 Mon Sep 17 00:00:00 2001 From: lusabo Date: Tue, 27 Aug 2013 16:23:56 -0300 Subject: [PATCH] Adição de testes --- impl/extension/jpa/src/test/java/template/JPACrudTest.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/impl/extension/jpa/src/test/java/template/JPACrudTest.java b/impl/extension/jpa/src/test/java/template/JPACrudTest.java index a7499cf..a506963 100644 --- a/impl/extension/jpa/src/test/java/template/JPACrudTest.java +++ b/impl/extension/jpa/src/test/java/template/JPACrudTest.java @@ -4,11 +4,14 @@ import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNull; +import java.util.List; + import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,9 +33,11 @@ public class JPACrudTest { return deployment; } - @Test - public void x() { - + @Before + public void eraseData() { + for(MyEntity myEntity : crud.findAll()) { + crud.delete(myEntity.getId()); + } } @Test @@ -66,6 +71,16 @@ public class JPACrudTest { assertEquals("update example", persisted.getDescription()); } + @Test + public void findAll() { + populate(4, 0); + + List list; + list = crud.findAll(); + + assertEquals(list.size(), 4); + } + private void populate(int size, int offset) { MyEntity entity; -- libgit2 0.21.2