Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If just plain unit testing is needed without JEE APIs it's possible to use the AbstractTest AbstractCdiAwareTest

Code Block
java
java
titleSimple JUnit 4 test with dependency injection
@RunWith(JUnit4.class)
public class SimpleJUnitTest extends org.apache.myfaces.extensions.cdi.test.junit4.AbstractTestAbstractCdiAwareTest
{
    @Inject
    private Logger logger;

    @Test
    public void testLogger()
    {
        assertNotNull(this.logger);
        this.logger.info("I'm a JUnit test-case and I can use dependency injection!");
    }
}

...