Search in sources :

Example 1 with ParametersTestBean

use of org.jboss.weld.environment.se.test.beans.ParametersTestBean in project core by weld.

the class StartMainEmptyArgsTest method testMainEmptyArgs.

/**
 * Test of main method, of class StartMain when no command-line args are
 * provided.
 */
@Test
public void testMainEmptyArgs() {
    WeldContainer container = startMain.go();
    MainTestBean mainTestBean = container.instance().select(MainTestBean.class).get();
    assertNotNull(mainTestBean);
    ParametersTestBean paramsBean = mainTestBean.getParametersTestBean();
    assertNotNull(paramsBean);
    assertNotNull(paramsBean.getParameters());
}
Also used : ParametersTestBean(org.jboss.weld.environment.se.test.beans.ParametersTestBean) WeldContainer(org.jboss.weld.environment.se.WeldContainer) MainTestBean(org.jboss.weld.environment.se.test.beans.MainTestBean) Test(org.junit.Test)

Example 2 with ParametersTestBean

use of org.jboss.weld.environment.se.test.beans.ParametersTestBean in project core by weld.

the class WeldMainTest method testInitialize.

/**
 * Test the alternate API for booting WeldContainer from an SE app.
 */
@Test
public void testInitialize() {
    Weld weld = new Weld();
    WeldContainer container = weld.initialize();
    MainTestBean mainTestBean = container.instance().select(MainTestBean.class).get();
    assertNotNull(mainTestBean);
    ParametersTestBean paramsBean = mainTestBean.getParametersTestBean();
    assertNotNull(paramsBean);
    assertNotNull(paramsBean.getParameters());
    weld.shutdown();
}
Also used : ParametersTestBean(org.jboss.weld.environment.se.test.beans.ParametersTestBean) WeldContainer(org.jboss.weld.environment.se.WeldContainer) MainTestBean(org.jboss.weld.environment.se.test.beans.MainTestBean) Weld(org.jboss.weld.environment.se.Weld) Test(org.junit.Test)

Example 3 with ParametersTestBean

use of org.jboss.weld.environment.se.test.beans.ParametersTestBean in project core by weld.

the class StartMainTest method testMain.

/**
 * Test of main method, of class StartMain. Checks that the beans found in
 * the org.jboss.weld.environment.se.beans package are initialised as
 * expected.
 */
@Test
public void testMain() {
    WeldContainer container = startMain.go();
    assertEquals(container.getId(), RegistrySingletonProvider.STATIC_INSTANCE);
    MainTestBean mainTestBean = container.instance().select(MainTestBean.class).get();
    assertNotNull(mainTestBean);
    ParametersTestBean paramsBean = mainTestBean.getParametersTestBean();
    assertNotNull(paramsBean);
    assertNotNull(paramsBean.getParameters());
    assertNotNull(paramsBean.getParameters().get(0));
    assertEquals(ARGS[0], paramsBean.getParameters().get(0));
    assertNotNull(paramsBean.getParameters().get(1));
    assertEquals(ARGS[1], paramsBean.getParameters().get(1));
    assertNotNull(paramsBean.getParameters().get(2));
    assertEquals(ARGS[2], paramsBean.getParameters().get(2));
}
Also used : ParametersTestBean(org.jboss.weld.environment.se.test.beans.ParametersTestBean) WeldContainer(org.jboss.weld.environment.se.WeldContainer) MainTestBean(org.jboss.weld.environment.se.test.beans.MainTestBean) Test(org.junit.Test)

Aggregations

WeldContainer (org.jboss.weld.environment.se.WeldContainer)3 MainTestBean (org.jboss.weld.environment.se.test.beans.MainTestBean)3 ParametersTestBean (org.jboss.weld.environment.se.test.beans.ParametersTestBean)3 Test (org.junit.Test)3 Weld (org.jboss.weld.environment.se.Weld)1