You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "John D. Ament (JIRA)" <ji...@apache.org> on 2015/01/21 14:16:34 UTC

[jira] [Resolved] (DELTASPIKE-821) check compatibility with gradle

     [ https://issues.apache.org/jira/browse/DELTASPIKE-821?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John D. Ament resolved DELTASPIKE-821.
--------------------------------------
    Resolution: Fixed

Added documentation for test control.  Since this is the only place where the code is directly run by gradle, should be good.

> check compatibility with gradle
> -------------------------------
>
>                 Key: DELTASPIKE-821
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-821
>             Project: DeltaSpike
>          Issue Type: Task
>          Components: Documentation, TestControl
>    Affects Versions: 1.2.1
>            Reporter: Mario-Leander Reimer
>            Assignee: John D. Ament
>             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)