Search in sources :

Example 1 with TestInstance

use of org.jboss.pnc.test.cdi.TestInstance in project pnc by project-ncl.

the class BuildDriverFactoryTest method shouldSkipDriversWhichAreNotMentionedInConfiguration.

@Test(expected = ExecutorException.class)
public void shouldSkipDriversWhichAreNotMentionedInConfiguration() throws Exception {
    // given
    ProperDriver testedBuildDriver = new ProperDriver();
    TestInstance<BuildDriver> allDrivers = new TestInstance<>(testedBuildDriver);
    Configuration configuration = new Configuration();
    BuildDriverFactory factory = new BuildDriverFactory(allDrivers, configuration);
    factory.initConfiguration();
    // when
    factory.getBuildDriver();
}
Also used : BuildDriver(org.jboss.pnc.spi.builddriver.BuildDriver) TestInstance(org.jboss.pnc.test.cdi.TestInstance) Configuration(org.jboss.pnc.common.Configuration) BuildDriverFactory(org.jboss.pnc.executor.servicefactories.BuildDriverFactory) Test(org.junit.Test)

Example 2 with TestInstance

use of org.jboss.pnc.test.cdi.TestInstance in project pnc by project-ncl.

the class BuildDriverFactoryTest method shouldPickProperDriver.

@Test
public void shouldPickProperDriver() throws Exception {
    // given
    ProperDriver testedBuildDriver = new ProperDriver();
    TestInstance<BuildDriver> allDrivers = new TestInstance<>(testedBuildDriver);
    Configuration configuration = mock(Configuration.class);
    BuildDriverFactory factory = new BuildDriverFactory(allDrivers, configuration);
    // when
    BuildDriver buildDriver = factory.getBuildDriver();
    // then
    assertThat(buildDriver).isEqualTo(testedBuildDriver);
}
Also used : BuildDriver(org.jboss.pnc.spi.builddriver.BuildDriver) TestInstance(org.jboss.pnc.test.cdi.TestInstance) Configuration(org.jboss.pnc.common.Configuration) BuildDriverFactory(org.jboss.pnc.executor.servicefactories.BuildDriverFactory) Test(org.junit.Test)

Aggregations

Configuration (org.jboss.pnc.common.Configuration)2 BuildDriverFactory (org.jboss.pnc.executor.servicefactories.BuildDriverFactory)2 BuildDriver (org.jboss.pnc.spi.builddriver.BuildDriver)2 TestInstance (org.jboss.pnc.test.cdi.TestInstance)2 Test (org.junit.Test)2