GH-187 - Unit tests for Spring Data repository detection.
Both imperative and reactive flavours.
This commit is contained in:
@@ -33,6 +33,7 @@ import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
|
||||
import org.springframework.modulith.core.ArchitecturallyEvidentType.SpringAwareArchitecturallyEvidentType;
|
||||
import org.springframework.modulith.core.ArchitecturallyEvidentType.SpringDataAwareArchitecturallyEvidentType;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -76,6 +77,24 @@ class ArchitecturallyEvidentTypeUnitTest {
|
||||
assertThat(type.isRepository()).isTrue();
|
||||
}
|
||||
|
||||
@Test // GH-187
|
||||
void detectsSpringDataRepositories() {
|
||||
|
||||
var type = ArchitecturallyEvidentType.of(
|
||||
classes.getRequiredClass(SampleRepository.class), Classes.NONE);
|
||||
|
||||
assertThat(type.isRepository()).isTrue();
|
||||
}
|
||||
|
||||
@Test // GH-187
|
||||
void detectsReactiveSpringDataRepositories() {
|
||||
|
||||
var type = ArchitecturallyEvidentType.of(
|
||||
classes.getRequiredClass(ReactiveSampleRepository.class), Classes.NONE);
|
||||
|
||||
assertThat(type.isRepository()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void doesNotConsiderEntityAggregateRoot() {
|
||||
|
||||
@@ -197,6 +216,9 @@ class ArchitecturallyEvidentTypeUnitTest {
|
||||
|
||||
interface SampleRepository extends CrudRepository<SampleEntity, UUID> {}
|
||||
|
||||
// GH-187
|
||||
interface ReactiveSampleRepository extends ReactiveCrudRepository<SampleEntity, UUID> {}
|
||||
|
||||
@Entity
|
||||
class OtherEntity {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user