Skip to content

Commit

Permalink
Use a single archive for ConvertersTest
Browse files Browse the repository at this point in the history
Avoids adding the InjectionBean into the archive twice, creating
ambiguous resolution errors.
  • Loading branch information
Azquelt committed Aug 25, 2022
1 parent f4e56d9 commit 2c3dcc5
Showing 1 changed file with 7 additions and 11 deletions.
Expand Up @@ -57,7 +57,6 @@
import org.jboss.arquillian.testng.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.testng.Assert;
import org.testng.annotations.Test;
Expand All @@ -77,8 +76,8 @@ public class ConverterTest extends Arquillian {

@Deployment
public static WebArchive deploy() {
JavaArchive testJar = ShrinkWrap
.create(JavaArchive.class, "converterTest.jar")
WebArchive testWar = ShrinkWrap
.create(WebArchive.class, "converterTest.war")
.addClass(ConverterTest.class)
.addPackage(CustomDbConfigSource.class.getPackage())
.addClasses(DuckConverter.class, Duck.class, Donald.class, UpperCaseDuckConverter.class,
Expand All @@ -87,19 +86,16 @@ public static WebArchive deploy() {
.addAsServiceProvider(ConfigSource.class, CustomDbConfigSource.class)
.addAsServiceProvider(ConfigSourceProvider.class, CustomConfigSourceProvider.class)
.addAsServiceProvider(Converter.class, DuckConverter.class)
.as(JavaArchive.class);
.as(WebArchive.class);

AbstractTest.addFile(testJar, "META-INF/microprofile-config.properties");
AbstractTest.addFile(testJar, "sampleconfig.yaml");
AbstractTest.addFile(testWar, "META-INF/microprofile-config.properties");
AbstractTest.addFile(testWar, "sampleconfig.yaml");

WebArchive war = ShrinkWrap
.create(WebArchive.class, "converterTest.war")
.addAsLibrary(testJar);
return war;
return testWar;
}

@Inject
InjectingBean bean;
private InjectingBean bean;

@Test(expectedExceptions = IllegalArgumentException.class)
public void testDonaldNotConvertedByDefault() {
Expand Down

0 comments on commit 2c3dcc5

Please sign in to comment.