2016/02/07 - Apache Onami has been retired.

For more information, please explore the Attic.

JSR330 integration

Apache Onami-Test provides a nice integration with JSR330 dependency injection for Java. By using javax.inject.Inject OnamiRunner will provide to inject the dependency inside your test case.

Here is a little example:

@RunWith( OnamiRunner.class )
public class InjectJSR330ModuleClassTestCase
    extends AbstractModule
{

    public void configure()
    {
        bind( Integer.class ).annotatedWith( Names.named( "numeber.version" ) ).toInstance( 10 );
    }

    @javax.inject.Inject
    @javax.inject.Named( "numeber.version" )
    private Integer version;

        ...

}