use of org.moduliths.model.SpringBean in project moduliths by moduliths.
the class DocumenterUnitTests method groupsSpringBeansByArchitecturallyEvidentType.
// #130
@Test
void groupsSpringBeansByArchitecturallyEvidentType() {
Groupings result = CanvasOptions.defaults().groupingBy(of("Representations", nameMatching(".*Representations"))).groupingBy(of("Interface implementations", subtypeOf(Stereotypes.SomeAppInterface.class))).groupBeans(modules.getModuleByName("stereotypes").orElseThrow(RuntimeException::new));
assertThat(result.keySet()).extracting(Grouping::getName).containsExactlyInAnyOrder("Controllers", "Services", "Repositories", "Event listeners", "Configuration properties", "Representations", "Interface implementations", "Others");
List<SpringBean> impls = result.byGroupName("Interface implementations");
//
assertThat(impls).hasSize(1).extracting(//
it -> it.getType()).extracting(//
JavaClass::getSimpleName).containsExactly("SomeAppInterfaceImplementation");
List<SpringBean> listeners = result.byGroupName("Event listeners");
//
assertThat(listeners).hasSize(2).extracting(//
it -> it.getType()).extracting(//
JavaClass::getSimpleName).containsOnly("SomeEventListener", "SomeTxEventListener");
}
Aggregations