org.jboss.arquillian.container.test.api.ShouldThrowException Java Examples

The following examples show how to use org.jboss.arquillian.container.test.api.ShouldThrowException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BrokenMessageBundleOnClassTest.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
/**
 * X TODO creating a WebArchive is only a workaround because JavaArchive
 * cannot contain other archives.
 */
@Deployment
@ShouldThrowException(Exception.class)
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "invalidMessageBundleTest.jar")
            .addPackage(BrokenMessageBundleClass.class.getPackage())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap
            .create(WebArchive.class, "invalidMessageBundleTest.war")
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
            .addAsLibraries(testJar)
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsServiceProvider(Extension.class,
                    MessageBundleExtension.class);
}
 
Example #2
Source File: InvalidCircuitBreakerFailureSuccess0Test.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
@ShouldThrowException(value = FaultToleranceDefinitionException.class)
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftInvalidCB6.jar")
        .addClasses(CircuitBreakerClientForValidationSuccess0.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    return ShrinkWrap
        .create(WebArchive.class, "ftInvalidCB6.war")
        .addAsLibrary(testJar);
}
 
Example #3
Source File: InvalidAsynchronousClassTest.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
@ShouldThrowException(value = FaultToleranceDefinitionException.class)
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftInvalidAsnycClass.jar")
        .addClasses(AsynchronousClientForValidationClass.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    return ShrinkWrap
        .create(WebArchive.class, "ftInvalidAsnycClass.war")
        .addAsLibrary(testJar);
}
 
Example #4
Source File: InvalidCircuitBreakerDelayTest.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
@ShouldThrowException(value = FaultToleranceDefinitionException.class)
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftInvalidCB1.jar")
        .addClasses(CircuitBreakerClientForValidationDelay.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    return ShrinkWrap
        .create(WebArchive.class, "ftInvalidCB1.war")
        .addAsLibrary(testJar);
}
 
Example #5
Source File: InvalidRetryMaxRetriesTest.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
@ShouldThrowException(value = FaultToleranceDefinitionException.class)
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftInvalidRetry2.jar")
        .addClasses(RetryClientForValidationMaxRetries.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    return ShrinkWrap
        .create(WebArchive.class, "ftInvalidRetry2.war")
        .addAsLibrary(testJar);
}
 
Example #6
Source File: IncompatibleFallbackPolicies.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
@ShouldThrowException(value = FaultToleranceDefinitionException.class)
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftInvalid.jar")
        .addClasses(FallbackClientWithBothFallbacks.class, IncompatibleFallbackHandler.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    return ShrinkWrap
        .create(WebArchive.class, "ftInvalidFallbackPolicy.war")
        .addAsLibrary(testJar);
}
 
Example #7
Source File: IncompatibleFallbackMethodWithArgsTest.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
@ShouldThrowException(value = FaultToleranceDefinitionException.class)
public static WebArchive deployAnotherApp() {
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "ftInvalid.jar")
            .addClasses(FallbackMethodWithArgsClient.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "ftInvalidFallbackMethodWithArgs.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #8
Source File: IncompatibleFallbackTest.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
@ShouldThrowException(value = FaultToleranceDefinitionException.class)
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftInvalid.jar")
        .addClasses(FallbackClient.class, IncompatibleFallbackHandler.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    return ShrinkWrap
        .create(WebArchive.class, "ftInvalidFallbackHandler.war")
        .addAsLibrary(testJar);
}
 
Example #9
Source File: IncompatibleFallbackMethodTest.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
@ShouldThrowException(value = FaultToleranceDefinitionException.class)
public static WebArchive deployAnotherApp() {
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "ftInvalid.jar")
            .addClasses(FallbackMethodClient.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "ftInvalidFallbackMethod.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #10
Source File: FallbackMethodWildcardNegativeTest.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
@ShouldThrowException(FaultToleranceDefinitionException.class)
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "ftFallbackMethodSuperclassPrivate.jar")
            .addClass(FallbackMethodWildcardNegativeBean.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    
    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "ftFallbackMethodSuperclassPrivate.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #11
Source File: FallbackMethodSubclassTest.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
@ShouldThrowException(FaultToleranceDefinitionException.class)
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "ftFallbackMethodSubclass.jar")
            .addClasses(FallbackMethodSubclassBeanA.class, FallbackMethodSubclassBeanB.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    
    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "ftFallbackMethodSubclass.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #12
Source File: FallbackMethodSuperclassPrivateTest.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
@ShouldThrowException(FaultToleranceDefinitionException.class)
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "ftFallbackMethodSuperclassPrivate.jar")
            .addClasses(FallbackMethodSuperclassPrivateBeanA.class, FallbackMethodSuperclassPrivateBeanB.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    
    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "ftFallbackMethodSuperclassPrivate.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #13
Source File: FallbackMethodOutOfPackageTest.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
@ShouldThrowException(FaultToleranceDefinitionException.class)
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "ftFallbackMethodOutOfPackage.jar")
            .addClasses(FallbackMethodOutOfPackageBeanA.class, FallbackMethodOutOfPackageBeanB.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    
    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "ftFallbackMethodOutOfPackage.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #14
Source File: MissingConverterOnInstanceInjectionTest.java    From ConfigJSR with Apache License 2.0 5 votes vote down vote up
@ShouldThrowException(DeploymentException.class)
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "missingConverterOnInstanceInjectionTest.jar")
            .addClass(CustomConverterBean.class)
            .addAsManifestResource(new StringAsset("my.customtype.value=xxxxx"), "javaconfig.properties")
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "missingConverterOnInstanceInjectionTest.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #15
Source File: MissingValueOnInstanceInjectionTest.java    From ConfigJSR with Apache License 2.0 5 votes vote down vote up
@ShouldThrowException(DeploymentException.class)
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "missingValueOnInstanceInjectionTest.jar")
            .addClass(ConfigOwner.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "missingValueOnInstanceInjectionTest.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #16
Source File: WrongConverterOnInstanceInjectionTest.java    From ConfigJSR with Apache License 2.0 5 votes vote down vote up
@ShouldThrowException(DeploymentException.class)
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "wrongConverterOnInstanceInjectionTest.jar")
            .addClass(ConfigOwner.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsManifestResource(new StringAsset("my.long.value=xxxxx"), "javaconfig.properties")
            .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "wrongConverterOnInstanceInjectionTest.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #17
Source File: MissingConverterOnInstanceInjectionTest.java    From microprofile-config with Apache License 2.0 5 votes vote down vote up
@ShouldThrowException(DeploymentException.class)
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "missingConverterOnInstanceInjectionTest.jar")
            .addClass(CustomConverterBean.class)
            .addAsManifestResource(new StringAsset("my.customtype.value=xxxxx"), "microprofile-config.properties")
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "missingConverterOnInstanceInjectionTest.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #18
Source File: MissingValueOnObserverMethodInjectionTest.java    From microprofile-config with Apache License 2.0 5 votes vote down vote up
@ShouldThrowException(DeploymentException.class)
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "missingValueOnObserverMethodInjectionTest.jar")
            .addClass(ConfigObserver.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "missingValueOnObserverMethodInjectionTest.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #19
Source File: MissingValueOnInstanceInjectionTest.java    From microprofile-config with Apache License 2.0 5 votes vote down vote up
@ShouldThrowException(DeploymentException.class)
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "missingValueOnInstanceInjectionTest.jar")
            .addClass(ConfigOwner.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "missingValueOnInstanceInjectionTest.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #20
Source File: WrongConverterOnInstanceInjectionTest.java    From microprofile-config with Apache License 2.0 5 votes vote down vote up
@ShouldThrowException(DeploymentException.class)
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "wrongConverterOnInstanceInjectionTest.jar")
            .addClass(ConfigOwner.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsManifestResource(new StringAsset("my.long.value=xxxxx"), "microprofile-config.properties")
            .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "wrongConverterOnInstanceInjectionTest.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #21
Source File: DuplicateAddonLifecycleProviderTest.java    From furnace with Eclipse Public License 1.0 5 votes vote down vote up
@Deployment
@ShouldThrowException
public static AddonArchive getDeployment()
{
   AddonArchive archive = ShrinkWrap.create(AddonArchive.class)
            .addClass(MockAddonLifecycleProvider.class)
            .addClass(MockAddonLifecycleProvider2.class)
            .addAsServiceProvider(AddonLifecycleProvider.class, MockAddonLifecycleProvider.class,
                     MockAddonLifecycleProvider2.class);

   return archive;
}
 
Example #22
Source File: ExceptionInjectionTest.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Deployment(testable = false)
@ShouldThrowException(javax.enterprise.inject.spi.DeploymentException.class)
public static WebArchive war() {
    return ShrinkWrap.create(WebArchive.class)
            .addAsWebInfResource(new StringAsset(Descriptors.create(BeansDescriptor.class)
                    .getOrCreateInterceptors()
                        .clazz("i.dont.exist.so.i.ll.make.the.deployment.fail")
                    .up()
                    .exportAsString()), ArchivePaths.create("beans.xml"));
}
 
Example #23
Source File: DeploymentExceptionErrorTest.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Deployment(testable = false)
@ShouldThrowException(OpenEJBRuntimeException.class)
public static WebArchive war() {
    return ShrinkWrap.create(WebArchive.class, "DeploymentExceptionErrorTest.war")
                .addAsWebInfResource(new StringAsset(Descriptors.create(BeansDescriptor.class)
                        .getOrCreateInterceptors()
                            .clazz("i.dont.exist.so.i.ll.make.the.deployment.fail")
                        .up()
                        .exportAsString()), ArchivePaths.create("beans.xml"));
}
 
Example #24
Source File: InvalidCircuitBreakerFailureSuccessNegTest.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
@ShouldThrowException(value = FaultToleranceDefinitionException.class)
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftInvalidCB7.jar")
        .addClasses(CircuitBreakerClientForValidationSuccessNeg.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    return ShrinkWrap
        .create(WebArchive.class, "ftInvalidCB7.war")
        .addAsLibrary(testJar);
}
 
Example #25
Source File: CollectionWithNoDefaultValueTest.java    From smallrye-config with Apache License 2.0 5 votes vote down vote up
@ShouldThrowException(DeploymentException.class)
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "CollectionWithNoDefaultValueTest.jar")
            .addClasses(CollectionWithNoDefaultValueTest.class, CollectionWithNoDefaultValueBean.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .as(JavaArchive.class);
    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "CollectionWithNoDefaultValueTest.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #26
Source File: MissingConnectorTest.java    From microprofile-reactive-messaging with Apache License 2.0 5 votes vote down vote up
@Deployment(managed = false, name = "missing-connector")
@ShouldThrowException(value = DeploymentException.class, testable = true)
public static Archive<JavaArchive> missingConnectorDeployment() {
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class)
        .addClasses(MyProcessor.class, ArchiveExtender.class)
        .addAsManifestResource(MissingConnectorTest.class.getResource("connector-config.properties"), "microprofile-config.properties")
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    ServiceLoader.load(ArchiveExtender.class).iterator().forEachRemaining(ext -> ext.extend(archive));
    return archive;
}
 
Example #27
Source File: MissingConnectorTest.java    From microprofile-reactive-messaging with Apache License 2.0 5 votes vote down vote up
@Deployment(managed = false, name = "missing-stream")
@ShouldThrowException(value = DeploymentException.class, testable = true)
public static Archive<JavaArchive> missingStreamDeployment() {
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class)
        .addClasses(MyProcessorWithBadStreamName.class, DummyConnector.class, ArchiveExtender.class)
        .addAsManifestResource(MissingConnectorTest.class.getResource("connector-config.properties"), "microprofile-config.properties")
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    ServiceLoader.load(ArchiveExtender.class).iterator().forEachRemaining(ext -> ext.extend(archive));
    return archive;
}
 
Example #28
Source File: InvalidSubscriberSignatureTest.java    From microprofile-reactive-messaging with Apache License 2.0 5 votes vote down vote up
@Deployment(managed = false, name = "incoming-returning-object")
@ShouldThrowException(value = DefinitionException.class, testable = true)
public static Archive<JavaArchive> incomingReturningNonVoid() {
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class)
        .addClasses(IncomingReturningNonVoid.class, ArchiveExtender.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    ServiceLoader.load(ArchiveExtender.class).iterator().forEachRemaining(ext -> ext.extend(archive));
    return archive;
}
 
Example #29
Source File: InvalidSubscriberSignatureTest.java    From microprofile-reactive-messaging with Apache License 2.0 5 votes vote down vote up
@Deployment(managed = false, name = "incoming-returning-non-void-cs")
@ShouldThrowException(value = DefinitionException.class, testable = true)
public static Archive<JavaArchive> incomingReturningNonVoidCompletionStage() {
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class)
        .addClasses(IncomingReturningNonVoidCompletionStage.class, ArchiveExtender.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    ServiceLoader.load(ArchiveExtender.class).iterator().forEachRemaining(ext -> ext.extend(archive));
    return archive;
}
 
Example #30
Source File: InvalidConfigurationTest.java    From microprofile-reactive-messaging with Apache License 2.0 5 votes vote down vote up
@Deployment(managed = false, name = "empty-incoming")
@ShouldThrowException(value = DeploymentException.class, testable = true)
public static Archive<JavaArchive> emptyIncoming() {
  JavaArchive archive = ShrinkWrap.create(JavaArchive.class)
    .addClasses(BeanWithEmptyIncoming.class, ArchiveExtender.class)
    .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

  ServiceLoader.load(ArchiveExtender.class).iterator().forEachRemaining(ext -> ext.extend(archive));
  return archive;
}