Annotation Type ShouldThrowException


  • @Documented
    @Retention(RUNTIME)
    @Target(METHOD)
    public @interface ShouldThrowException
    Define that a Deployment should cause a exception during deployment. If the Container does not throw a exception, or the exception is of the wrong type, a RuntimeException will be thrown and the test failed. If the correct exception is thrown the test will execute as normal.

    Usage Example:

    
     @Deployment @ShouldThrowException(WeldDeploymentException.class)
     public static WebArchive create() {
          return ShrinkWrap.create(WebArchive.class);
     }
     

    Adding the @ShouldThrowException annotation will force the @Deployment to be testable = false which again will force a @RunAsClient test run mode, unless you explicitly mark testable = true

    Version:
    $Revision: $
    Author:
    Aslak Knutsen
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean testable  
      Class<? extends Exception> value  
    • Element Detail

      • value

        Class<? extends Exception> value
        Default:
        java.lang.Exception.class
      • testable

        boolean testable
        Returns:
        whether or not this deployment is intended to be testable, default is false
        Default:
        false