tests/arq/src/test/java/org/jboss/test/arquillian/ce/common/TodoList.java
/**
     * Checks if an item is present at the todo list.
     *
     * @param url         The url for the service
     * @param summary     The summary to be checked
     * @param description The description to be checked
     * @throws Exception
     */
Checks if an item is present at the todo list.
@param url         The url for the service
@param summary     The summary to be checked
@param description The description to be checked
@throws Exception
Checks if an item is present at the todo list . @param url The url for the service @param summary The summary to be checked @param description The description to be checked @throws Exception
public static void checkItem(String url, String summary, String description) throws Exception {
        RestAssured.useRelaxedHTTPSValidation();
        AtomicReference<Response> responseRef = new AtomicReference<>();
        await().atMost(20, TimeUnit.SECONDS).pollInterval(5, TimeUnit.SECONDS).until(() -> {
            try {
                Response r = get(url);
                if (r.getStatusCode() == 200) {
                    responseRef.set(r);
                    return true;
                }
                return false;
            } catch (Exception e) {
                return false;
            }
        });
        Response response = responseRef.get();
        if (response == null) {
            throw new Exception("Could not get response!");
        }
        String responseString = response.print();
        Assert.assertEquals("Got an invalid response code. Body: " + responseString, 200, response.getStatusCode());
        /* TODO: Improve this check */
        Assert.assertTrue("Response: " + responseString + " - Summary: " + summary, responseString.contains(summary));
        Assert.assertTrue("Response: " + responseString + " - Description: " + description, responseString.contains(description));
    }
public static void checkItem ( String url , String summary , String description ) throws Exception { RestAssured . useRelaxedHTTPSValidation ( ) ; AtomicReference < Response > responseRef = new AtomicReference < > ( ) ; await ( ) . atMost ( 20 , TimeUnit . SECONDS ) . pollInterval ( 5 , TimeUnit . SECONDS ) . until ( ( ) -> { try { Response r = get ( url ) ; if ( r . getStatusCode ( ) == 200 ) { responseRef . set ( r ) ; return true ; } return false ; } catch ( Exception e ) { return false ; } } ) ; Response response = responseRef . get ( ) ; if ( response == null ) { throw new Exception ( "Could not get response!" ) ; } String responseString = response . print ( ) ; Assert . assertEquals ( "Got an invalid response code. Body: " + responseString , 200 , response . getStatusCode ( ) ) ; /* TODO: Improve this check */ Assert . assertTrue ( "Response: " + responseString + " - Summary: " + summary , responseString . contains ( summary ) ) ; Assert . assertTrue ( "Response: " + responseString + " - Description: " + description , responseString . contains ( description ) ) ; }
Checks if an item is present at the todo list.
Checks if an item is present at the todo list .