Class ThrowAction

  • All Implemented Interfaces:
    org.hamcrest.SelfDescribing, Action, Invokable

    public class ThrowAction
    extends java.lang.Object
    implements Action
    Throws an exception.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Throwable throwable  
    • Constructor Summary

      Constructors 
      Constructor Description
      ThrowAction​(java.lang.Throwable throwable)  
    • Field Detail

      • throwable

        private java.lang.Throwable throwable
    • Constructor Detail

      • ThrowAction

        public ThrowAction​(java.lang.Throwable throwable)
    • Method Detail

      • invoke

        public java.lang.Object invoke​(Invocation invocation)
                                throws java.lang.Throwable
        Description copied from interface: Invokable
        Performs an action in response to an invocation.
        Specified by:
        invoke in interface Invokable
        Parameters:
        invocation - The invocation to perform.
        Returns:
        The result of the invocation, if not throwing an exception. Must return null if the invoked method has a void return type.
        Throws:
        java.lang.Throwable - An exception to be thrown to the caller, if not returning a value. Any checked exception thrown must be in the throws list of the invoked method.
      • describeTo

        public void describeTo​(org.hamcrest.Description description)
        Specified by:
        describeTo in interface org.hamcrest.SelfDescribing
      • checkTypeCompatiblity

        private void checkTypeCompatiblity​(java.lang.Class<?>[] allowedExceptionTypes)
      • reportIncompatibleCheckedException

        private void reportIncompatibleCheckedException​(java.lang.Class<?>[] allowedTypes)
      • isThrowingCheckedException

        private boolean isThrowingCheckedException()