Commit d8b0021bd17c153cbbb9f4bc601804e8f8f3c92d
1 parent
1e6de13d
Exists in
master
Externalizada classe de testes Contact, que antes estava como interna. A
especificação JPA não permite classes internas anotadas com @Entity.
Showing
2 changed files
with
29 additions
and
25 deletions
Show diff stats
impl/extension/jpa/src/test/java/br/gov/frameworkdemoiselle/domain/Contact.java
0 → 100644
| @@ -0,0 +1,28 @@ | @@ -0,0 +1,28 @@ | ||
| 1 | +package br.gov.frameworkdemoiselle.domain; | ||
| 2 | + | ||
| 3 | +import java.io.Serializable; | ||
| 4 | + | ||
| 5 | +import javax.persistence.Column; | ||
| 6 | +import javax.persistence.Entity; | ||
| 7 | +import javax.persistence.GeneratedValue; | ||
| 8 | +import javax.persistence.Id; | ||
| 9 | + | ||
| 10 | +@Entity | ||
| 11 | +public class Contact implements Serializable { | ||
| 12 | + | ||
| 13 | + private static final long serialVersionUID = 1L; | ||
| 14 | + | ||
| 15 | + @Id | ||
| 16 | + @GeneratedValue | ||
| 17 | + @Column | ||
| 18 | + private Long id; | ||
| 19 | + | ||
| 20 | + public void setId(Long id) { | ||
| 21 | + this.id = id; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + public Long getId() { | ||
| 25 | + return id; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | +} |
impl/extension/jpa/src/test/java/br/gov/frameworkdemoiselle/template/JPACrudTest.java
| @@ -45,19 +45,14 @@ import static org.powermock.api.easymock.PowerMock.replayAll; | @@ -45,19 +45,14 @@ import static org.powermock.api.easymock.PowerMock.replayAll; | ||
| 45 | import static org.powermock.api.easymock.PowerMock.verifyAll; | 45 | import static org.powermock.api.easymock.PowerMock.verifyAll; |
| 46 | import static org.powermock.reflect.Whitebox.setInternalState; | 46 | import static org.powermock.reflect.Whitebox.setInternalState; |
| 47 | 47 | ||
| 48 | -import java.io.Serializable; | ||
| 49 | import java.util.ArrayList; | 48 | import java.util.ArrayList; |
| 50 | import java.util.HashMap; | 49 | import java.util.HashMap; |
| 51 | import java.util.List; | 50 | import java.util.List; |
| 52 | import java.util.Map; | 51 | import java.util.Map; |
| 53 | 52 | ||
| 54 | import javax.enterprise.inject.Instance; | 53 | import javax.enterprise.inject.Instance; |
| 55 | -import javax.persistence.Column; | ||
| 56 | -import javax.persistence.Entity; | ||
| 57 | import javax.persistence.EntityManager; | 54 | import javax.persistence.EntityManager; |
| 58 | import javax.persistence.EntityManagerFactory; | 55 | import javax.persistence.EntityManagerFactory; |
| 59 | -import javax.persistence.GeneratedValue; | ||
| 60 | -import javax.persistence.Id; | ||
| 61 | import javax.persistence.Persistence; | 56 | import javax.persistence.Persistence; |
| 62 | import javax.persistence.Query; | 57 | import javax.persistence.Query; |
| 63 | import javax.persistence.TransactionRequiredException; | 58 | import javax.persistence.TransactionRequiredException; |
| @@ -80,6 +75,7 @@ import org.powermock.reflect.Whitebox; | @@ -80,6 +75,7 @@ import org.powermock.reflect.Whitebox; | ||
| 80 | 75 | ||
| 81 | import br.gov.frameworkdemoiselle.DemoiselleException; | 76 | import br.gov.frameworkdemoiselle.DemoiselleException; |
| 82 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 77 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
| 78 | +import br.gov.frameworkdemoiselle.domain.Contact; | ||
| 83 | import br.gov.frameworkdemoiselle.internal.implementation.PaginationImpl; | 79 | import br.gov.frameworkdemoiselle.internal.implementation.PaginationImpl; |
| 84 | import br.gov.frameworkdemoiselle.pagination.Pagination; | 80 | import br.gov.frameworkdemoiselle.pagination.Pagination; |
| 85 | import br.gov.frameworkdemoiselle.pagination.PaginationContext; | 81 | import br.gov.frameworkdemoiselle.pagination.PaginationContext; |
| @@ -110,26 +106,6 @@ public class JPACrudTest { | @@ -110,26 +106,6 @@ public class JPACrudTest { | ||
| 110 | setInternalState(this.contactDAO, EntityManager.class, this.entityManager); | 106 | setInternalState(this.contactDAO, EntityManager.class, this.entityManager); |
| 111 | } | 107 | } |
| 112 | 108 | ||
| 113 | - @Entity | ||
| 114 | - class Contact implements Serializable { | ||
| 115 | - | ||
| 116 | - private static final long serialVersionUID = 1L; | ||
| 117 | - | ||
| 118 | - @Id | ||
| 119 | - @GeneratedValue | ||
| 120 | - @Column | ||
| 121 | - private Long id; | ||
| 122 | - | ||
| 123 | - public void setId(Long id) { | ||
| 124 | - this.id = id; | ||
| 125 | - } | ||
| 126 | - | ||
| 127 | - public Long getId() { | ||
| 128 | - return id; | ||
| 129 | - } | ||
| 130 | - | ||
| 131 | - } | ||
| 132 | - | ||
| 133 | @Test | 109 | @Test |
| 134 | public void testDelete() { | 110 | public void testDelete() { |
| 135 | expect(this.entityManager.getReference(Contact.class, null)).andReturn(null); | 111 | expect(this.entityManager.getReference(Contact.class, null)).andReturn(null); |