@@ -0,0 +1,1939 @@
+package com.aemreunal.helper;%0A%0A/*%0A ***************************%0A * Copyright (c) 2014      *%0A *                         *%0A * This code belongs to:   *%0A *                         *%0A * @author Ahmet Emre %C3%9Cnal *%0A * S001974                 *%0A *                         *%0A * aemreunal@gmail.com     *%0A * emre.unal@ozu.edu.tr    *%0A *                         *%0A * aemreunal.com           *%0A ***************************%0A */%0A%0Aimport org.apache.http.HttpStatus;%0Aimport com.aemreunal.config.GlobalSettings;%0Aimport com.aemreunal.domain.UserInfo;%0Aimport com.jayway.restassured.path.json.JsonPath;%0Aimport com.jayway.restassured.response.ValidatableResponse;%0A%0Aimport static com.jayway.restassured.RestAssured.given;%0A%0Apublic class EntityGetter %7B%0A    public static UserInfo getUser(String username) %7B%0A        JsonPath responseJson = getEntity(%22/%22 + username);%0A        return new UserInfo(responseJson.getString(%22username%22), null, responseJson.getLong(%22userId%22));%0A    %7D%0A%0A    public static void failToGetUser(String username) %7B%0A        ValidatableResponse response = sendRequest(%22/%22 + username, HttpStatus.SC_NOT_FOUND);%0A    %7D%0A%0A    private static JsonPath getEntity(String path) %7B%0A        ValidatableResponse response = sendRequest(path, HttpStatus.SC_OK);%0A        JsonPath responseJson = response.extract()%0A                                        .body()%0A                                        .jsonPath();%0A        System.out.println(%22Create response:%22);%0A        responseJson.prettyPrint();%0A        return responseJson;%0A    %7D%0A%0A    private static ValidatableResponse sendRequest(String path, int httpStatus) %7B%0A        if (path.equals(%22%22)) %7B%0A            path = %22/%22;%0A        %7D%0A        return given().log().ifValidationFails()%0A%0A                      .when()%0A                      .get(GlobalSettings.BASE_CONTEXT_PATH + path)%0A%0A                      .then()%0A                      .log().ifValidationFails()%0A                      .statusCode(httpStatus);%0A    %7D%0A%7D%0A

Create EntityGetter helper class