Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2011-10-06 13:32:21 +0000
committerkmoore2011-10-06 13:32:21 +0000
commit14975e5e3c962f0a0c5d1f18659d7eeeba1b9025 (patch)
tree9fcd51a50b5710b860bba2517682c079a090cb72 /jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt
parent8ffdf7bca3c61b0e0e7dabf7af5ddb20aefc4ec9 (diff)
downloadwebtools.dali-14975e5e3c962f0a0c5d1f18659d7eeeba1b9025.tar.gz
webtools.dali-14975e5e3c962f0a0c5d1f18659d7eeeba1b9025.tar.xz
webtools.dali-14975e5e3c962f0a0c5d1f18659d7eeeba1b9025.zip
360002 - NPE when you add a JPA annotation to a class constructor
Diffstat (limited to 'jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt')
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
index fb6019638b..0147eb8427 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
@@ -212,6 +212,30 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
}
});
}
+
+ private ICompilationUnit createTestEntityAnnotatedConstructor() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("@Id").append(CR);
+ sb.append(" public " + TYPE_NAME + "() {").append(CR);
+ sb.append(" super();").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ sb.append(" ");
+ }
+ });
+ }
public GenericJavaPersistentTypeTests(String name) {
super(name);
@@ -837,6 +861,17 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
assertEquals(AccessType.FIELD, javaPersistentType.getDefaultAccess());
assertNull(javaPersistentType.getSpecifiedAccess());
}
+
+ //this is invalid and covered by validation (bug 360002)
+ public void testGetAccessConstructorAnnotated() throws Exception {
+ createTestEntityAnnotatedConstructor();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentType javaPersistentType = getJavaPersistentType();
+
+ assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
+ assertEquals(AccessType.PROPERTY, javaPersistentType.getDefaultAccess());
+ assertNull(javaPersistentType.getSpecifiedAccess());
+ }
private ICompilationUnit createTestEntityAnnotatedNonPersistableMethod() throws Exception {
return this.createTestType(new DefaultAnnotationWriter() {

Back to the top