Search in sources :

Example 1 with Service

use of com.buschmais.jqassistant.plugin.java.test.set.scanner.serviceloader.Service in project jqa-java-plugin by buschmais.

the class ServiceLoaderIT method verifyServiceLoaderDescriptor.

/**
     * Verifies the expected service loader descriptor and its content.
     */
private void verifyServiceLoaderDescriptor() {
    store.beginTransaction();
    List<ServiceLoaderDescriptor> serviceLoaderDescriptors = query("MATCH (sd:ServiceLoader:File) RETURN sd").getColumn("sd");
    assertThat(serviceLoaderDescriptors.size(), equalTo(1));
    ServiceLoaderDescriptor serviceLoaderDescriptor = serviceLoaderDescriptors.get(0);
    assertThat(serviceLoaderDescriptor.getFileName(), endsWith("/META-INF/services/" + Service.class.getName()));
    assertThat(serviceLoaderDescriptor.getType(), typeDescriptor(Service.class));
    List<TypeDescriptor> serviceTypes = serviceLoaderDescriptor.getContains();
    assertThat(serviceTypes.size(), equalTo(2));
    assertThat(serviceTypes, hasItem(typeDescriptor(ServiceImpl.class)));
    assertThat(serviceTypes, hasItem(typeDescriptor(OuterClass.InnerClassServiceImpl.class)));
    store.commitTransaction();
}
Also used : TypeDescriptor(com.buschmais.jqassistant.plugin.java.api.model.TypeDescriptor) OuterClass(com.buschmais.jqassistant.plugin.java.test.set.scanner.serviceloader.OuterClass) Service(com.buschmais.jqassistant.plugin.java.test.set.scanner.serviceloader.Service) ServiceLoaderDescriptor(com.buschmais.jqassistant.plugin.java.api.model.ServiceLoaderDescriptor)

Aggregations

ServiceLoaderDescriptor (com.buschmais.jqassistant.plugin.java.api.model.ServiceLoaderDescriptor)1 TypeDescriptor (com.buschmais.jqassistant.plugin.java.api.model.TypeDescriptor)1 OuterClass (com.buschmais.jqassistant.plugin.java.test.set.scanner.serviceloader.OuterClass)1 Service (com.buschmais.jqassistant.plugin.java.test.set.scanner.serviceloader.Service)1