Support for jMolecules' @Identity annotation.

Fixes #2438
Original pull request: #2439.
This commit is contained in:
Oliver Drotbohm
2021-08-25 17:23:18 +02:00
committed by Mark Paluch
parent 23ff807a90
commit c7c2df6cd9
2 changed files with 29 additions and 1 deletions

View File

@@ -28,6 +28,7 @@ import java.util.function.Function;
import java.util.stream.Stream;
import org.assertj.core.api.ClassAssert;
import org.jmolecules.ddd.annotation.Identity;
import org.jmolecules.ddd.types.AggregateRoot;
import org.jmolecules.ddd.types.Association;
import org.jmolecules.ddd.types.Identifier;
@@ -329,6 +330,14 @@ public class AnnotationBasedPersistentPropertyUnitTests<P extends AnnotationBase
.allMatch(it -> it.equals(ClassTypeInformation.from(Sample.class)));
}
@Test // #2438
void detectsJMoleculesIdentity() {
SamplePersistentProperty property = getProperty(JMolecules.class, "identifier");
assertThat(property.isIdProperty()).isTrue();
}
@SuppressWarnings("unchecked")
private Map<Class<? extends Annotation>, Annotation> getAnnotationCache(SamplePersistentProperty property) {
return (Map<Class<? extends Annotation>, Annotation>) ReflectionTestUtils.getField(property, "annotationCache");
@@ -515,6 +524,7 @@ public class AnnotationBasedPersistentPropertyUnitTests<P extends AnnotationBase
}
static class JMolecules {
@Identity Long identifier;
Association<JMoleculesAggregate, Identifier> association;
}