Search in sources :

Example 1 with AlphaFromDirectory

use of org.jboss.weld.environment.se.test.synthethic.testpackage.AlphaFromDirectory in project core by weld.

the class SyntheticBeanArchiveFromDirectoryTest method testAddPackageFromDirectory.

@Test
public void testAddPackageFromDirectory() {
    try (WeldContainer container = new Weld().disableDiscovery().addPackages(AlphaFromDirectory.class.getPackage()).initialize()) {
        AlphaFromDirectory alpha = container.select(AlphaFromDirectory.class).get();
        Instance<BetaFromDirectory> betaInstance = container.select(BetaFromDirectory.class);
        assertTrue(betaInstance.isUnsatisfied());
        assertNotNull(alpha);
        assertEquals(1, alpha.ping());
    }
}
Also used : WeldContainer(org.jboss.weld.environment.se.WeldContainer) AlphaFromDirectory(org.jboss.weld.environment.se.test.synthethic.testpackage.AlphaFromDirectory) BetaFromDirectory(org.jboss.weld.environment.se.test.synthethic.testpackage.nested.BetaFromDirectory) Weld(org.jboss.weld.environment.se.Weld) Test(org.junit.Test)

Example 2 with AlphaFromDirectory

use of org.jboss.weld.environment.se.test.synthethic.testpackage.AlphaFromDirectory in project core by weld.

the class SyntheticBeanArchiveFromDirectoryTest method testAddPackageFromDirectoryRecursively.

@Test
public void testAddPackageFromDirectoryRecursively() {
    try (WeldContainer container = new Weld().disableDiscovery().addPackages(true, AlphaFromDirectory.class.getPackage()).initialize()) {
        AlphaFromDirectory alpha = container.select(AlphaFromDirectory.class).get();
        Instance<BetaFromDirectory> betaInstance = container.select(BetaFromDirectory.class);
        assertFalse(betaInstance.isUnsatisfied());
        assertNotNull(alpha);
        assertNotNull(betaInstance.get());
        assertEquals(1, alpha.ping());
        assertEquals(1, betaInstance.get().ping());
    }
}
Also used : WeldContainer(org.jboss.weld.environment.se.WeldContainer) AlphaFromDirectory(org.jboss.weld.environment.se.test.synthethic.testpackage.AlphaFromDirectory) BetaFromDirectory(org.jboss.weld.environment.se.test.synthethic.testpackage.nested.BetaFromDirectory) Weld(org.jboss.weld.environment.se.Weld) Test(org.junit.Test)

Aggregations

Weld (org.jboss.weld.environment.se.Weld)2 WeldContainer (org.jboss.weld.environment.se.WeldContainer)2 AlphaFromDirectory (org.jboss.weld.environment.se.test.synthethic.testpackage.AlphaFromDirectory)2 BetaFromDirectory (org.jboss.weld.environment.se.test.synthethic.testpackage.nested.BetaFromDirectory)2 Test (org.junit.Test)2