[ https://issues.apache.org/jira/browse/DELTASPIKE-821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14285594#comment-14285594 ]
John D. Ament commented on DELTASPIKE-821: ------------------------------------------ [~gpetracek] Not sure if we should just list out this sourceSets hack on the CDI Test Control module page? http://deltaspike.apache.org/documentation/test-control.html > check compatibility with gradle > ------------------------------- > > Key: DELTASPIKE-821 > URL: https://issues.apache.org/jira/browse/DELTASPIKE-821 > Project: DeltaSpike > Issue Type: Task > Components: TestControl > Affects Versions: 1.2.1 > Reporter: Mario-Leander Reimer > Fix For: 1.2.2 > > Attachments: cdi-logging.zip > > > When using the DeltaSpike Test-Control module I noticed that unit tests that > run perfectly fine with Maven won't run with Gradle at all. > Let's say you have the following producer method to create a SLF4J Logger > instance: > {code:title=LoggerProducer.java} > public class LoggerProducer { > @Produces > @Default > public Logger createLogger(final InjectionPoint ip) { > Class declaringClass = ip.getMember().getDeclaringClass(); > return org.slf4j.LoggerFactory.getLogger(declaringClass); > } > } > {code} > The test for this is also pretty simple: > {code:title=LoggerProducerTest.java} > @RunWith(CdiTestRunner.class) > public class LoggerProducerTest { > @Inject > private Logger logger; > @Test > public void testCreateLogger() throws Exception { > assertThat(logger, is(notNullValue())); > } > } > {code} > Weld as well as OpenWebBeans throw an exception when the unit test is > executed by Gradle, because no suitable beans seem to be found for injection. > I have attached a running demo project so you can see for yourself. -- This message was sent by Atlassian JIRA (v6.3.4#6332)