Class RestTestBase

    • Constructor Detail

      • RestTestBase

        public RestTestBase()
    • Method Detail

      • assertU

        public static void assertU​(String update)
        Validates an update XML String is successful
      • assertU

        public static void assertU​(String message,
                                   String update)
        Validates an update XML String is successful
      • assertFailedU

        public static void assertFailedU​(String update)
        Validates an update XML String failed
      • assertFailedU

        public static void assertFailedU​(String message,
                                         String update)
        Validates an update XML String failed
      • assertQ

        public static void assertQ​(String request,
                                   String... tests)
        Validates a query matches some XPath test expressions
        Parameters:
        request - a URL path with optional query params, e.g. "/schema/fields?fl=id,_version_"
      • JQ

        public static String JQ​(String request)
                         throws Exception
        Makes a query request and returns the JSON string response
        Parameters:
        request - a URL path with optional query params, e.g. "/schema/fields?fl=id,_version_"
        Throws:
        Exception
      • assertJQ

        public static void assertJQ​(String request,
                                    double delta,
                                    String... tests)
                             throws Exception
        Validates a query matches some JSON test expressions and closes the query. The text expression is of the form path:JSON. To facilitate easy embedding in Java strings, the JSON can have double quotes replaced with single quotes.

        Please use this with care: this makes it easy to match complete structures, but doing so can result in fragile tests if you are matching more than what you want to test.

        Parameters:
        request - a URL path with optional query params, e.g. "/schema/fields?fl=id,_version_"
        delta - tolerance allowed in comparing float/double values
        tests - JSON path expression + '==' + expected value
        Throws:
        Exception
      • assertJPut

        public static void assertJPut​(String request,
                                      String content,
                                      double delta,
                                      String... tests)
                               throws Exception
        Validates the response from a PUT request matches some JSON test expressions and closes the query. The text expression is of the form path==JSON. To facilitate easy embedding in Java strings, the JSON can have double quotes replaced with single quotes.

        Please use this with care: this makes it easy to match complete structures, but doing so can result in fragile tests if you are matching more than what you want to test.

        Parameters:
        request - a URL path with optional query params, e.g. "/schema/fields?fl=id,_version_"
        content - The content to include with the PUT request
        delta - tolerance allowed in comparing float/double values
        tests - JSON path expression + '==' + expected value
        Throws:
        Exception
      • assertJPost

        public static void assertJPost​(String request,
                                       String content,
                                       double delta,
                                       String... tests)
                                throws Exception
        Validates the response from a PUT request matches some JSON test expressions and closes the query. The text expression is of the form path==JSON. To facilitate easy embedding in Java strings, the JSON can have double quotes replaced with single quotes.

        Please use this with care: this makes it easy to match complete structures, but doing so can result in fragile tests if you are matching more than what you want to test.

        Parameters:
        request - a URL path with optional query params, e.g. "/schema/fields?fl=id,_version_"
        content - The content to include with the PUT request
        delta - tolerance allowed in comparing float/double values
        tests - JSON path expression + '==' + expected value
        Throws:
        Exception
      • assertJDelete

        public static void assertJDelete​(String request,
                                         double delta,
                                         String... tests)
                                  throws Exception
        Deletes a resource and then matches some JSON test expressions against the response using the specified double delta tolerance.
        Throws:
        Exception