Class RqFallback.Fake

  • All Implemented Interfaces:
    Body, RqFallback, Head, Request
    Enclosing interface:
    RqFallback

    public static final class RqFallback.Fake
    extends Object
    implements RqFallback
    Fake implementation, for unit tests mostly.

    Use this class in unit tests, when you need to create a fake version of a request with an exception inside. For example:

     new TkIndex().act(
       new RqFallback.Fake("/(.*)", "/hello")
     );
    Since:
    0.13
    • Constructor Detail

      • Fake

        public Fake​(int code)
        Ctor.
        Parameters:
        code - HTTP status code
      • Fake

        public Fake​(int code,
                    Throwable error)
        Ctor.
        Parameters:
        code - HTTP status code
        error - Exception
      • Fake

        public Fake​(Request req,
                    int code,
                    Throwable error)
        Ctor.
        Parameters:
        req - Request
        code - HTTP status code
        error - Exception
    • Method Detail

      • code

        public int code()
        Description copied from interface: RqFallback
        Get HTTP status code suggested.
        Specified by:
        code in interface RqFallback
        Returns:
        HTTP status code