Source:
private void deleteApplication() throws Exception { HttpResponse response = sendGetRequest(String.format(httpsStoreUrl + "/site/pages" + "/applications.jag?tenant=" + storeContext.getSuperTenant().getDomain())); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusLine().getStatusCode(), "Response mismatch not 200"); String csrf = response.getLastHeader("Set-Cookie").getElements()[0].getValue(); EntityUtils.consume(response.getEntity()); urlParameters.clear(); urlParameters.add(new BasicNameValuePair("action", "removeApplication")); urlParameters.add(new BasicNameValuePair("application", testApplicationName)); response = sendPOSTMessageWithCSRF(httpsStoreUrl + "/site/blocks/application/" + "application-remove/ajax/application-remove.jag", urlParameters, csrf); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusLine().getStatusCode(), "Response mismatch not 200"); boolean errorOccur = getResponseBody(response).contains("\"error\" : true"); assertTrue(!errorOccur, "Error on Application deletion"); EntityUtils.consume(response.getEntity()); urlParameters.clear(); urlParameters.add(new BasicNameValuePair("action", "sessionCheck")); response = sendPOSTMessage(httpsStoreUrl + "/site/blocks/user/login/ajax/sessionCheck.jag", urlParameters); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusLine().getStatusCode(), "Response mismatch not 200"); EntityUtils.consume(response.getEntity()); response = sendGetRequest(httpsStoreUrl + "/site/blocks/application/" + "application-list/ajax/application-list.jag?action=getApplications"); boolean appExist = getResponseBody(response).contains("\"name\" : \"" + testApplicationName + "\""); assertFalse(appExist, "Application Deletion not successfull"); EntityUtils.consume(response.getEntity()); }

Target:
private void deleteApplication() throws Exception { HttpResponse response = sendGetRequest(String.format(httpsStoreUrl + "/site/pages" + "/applications.jag?tenant=" + storeContext.getSuperTenant().getDomain())); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusLine().getStatusCode(), "Response mismatch not 200"); String csrf = response.getLastHeader("Set-Cookie").getElements()[0].getValue(); EntityUtils.consume(response.getEntity()); urlParameters.clear(); urlParameters.add(new BasicNameValuePair("action", "removeApplication")); urlParameters.add(new BasicNameValuePair("application", testApplicationName)); response = sendPOSTMessageWithCSRF(httpsStoreUrl + "/site/blocks/application/" + "application-remove/ajax/application-remove.jag", urlParameters, csrf); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusLine().getStatusCode(), "Response mismatch not 200"); boolean isError = getResponseBody(response).contains("\"error\" : true"); assertFalse(isError, "Error on Application deletion"); EntityUtils.consume(response.getEntity()); urlParameters.clear(); urlParameters.add(new BasicNameValuePair("action", "sessionCheck")); response = sendPOSTMessage(httpsStoreUrl + "/site/blocks/user/login/ajax/sessionCheck.jag", urlParameters); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusLine().getStatusCode(), "Response mismatch not 200"); EntityUtils.consume(response.getEntity()); response = sendGetRequest(httpsStoreUrl + "/site/blocks/application/" + "application-list/ajax/application-list.jag?action=getApplications"); boolean isAppExist = getResponseBody(response).contains("\"name\" : \"" + testApplicationName + "\""); assertFalse(isAppExist, "Application Deletion not successfull"); EntityUtils.consume(response.getEntity()); }