Search in sources :

Example 11 with Response

use of com.coveros.selenified.services.Response in project selenified by Coveros.

the class ResponseTest method confirmEqualsObjectNullTest.

@Test
public void confirmEqualsObjectNullTest() throws IOException {
    JsonArray json = new JsonArray();
    json.add("name");
    Response response = new Response(5, json, "");
    response.setOutputFile(outputFile);
    response.assertEquals(new JsonObject());
    String content = Files.toString(file, Charsets.UTF_8);
    Assert.assertTrue(content.matches("[.\\s\\S]+   <tr>\n    <td align='center'>1.</td>\n    <td> </td>\n    <td>Expected to find a response of:<div><i>\\{\\}</i></div></td>\n    <td>Found a response of:<div><i>\\[<br/>\\&nbsp;\\&nbsp;\"name\"<br/>\\]</i></div></td>\n    <td>[0-9]+ms / [0-9]+ms</td>\n    <td class='fail'>Fail</td>\n   </tr>\n"));
}
Also used : JsonArray(com.google.gson.JsonArray) Response(com.coveros.selenified.services.Response) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 12 with Response

use of com.coveros.selenified.services.Response in project selenified by Coveros.

the class ResponseTest method checkNewResponseCodeCodeTest.

@Test
public void checkNewResponseCodeCodeTest() {
    Response response = new Response(5);
    Assert.assertEquals(response.getCode(), 5);
}
Also used : Response(com.coveros.selenified.services.Response) Test(org.testng.annotations.Test)

Example 13 with Response

use of com.coveros.selenified.services.Response in project selenified by Coveros.

the class ResponseTest method confirmEqualsObjectFailTest.

@Test
public void confirmEqualsObjectFailTest() throws IOException {
    JsonObject json = new JsonObject();
    json.addProperty("name", "john");
    Response response = new Response(5, json, "");
    response.setOutputFile(outputFile);
    response.assertEquals(new JsonObject());
    String content = Files.toString(file, Charsets.UTF_8);
    Assert.assertTrue(content.matches("[.\\s\\S]+   <tr>\n    <td align='center'>1.</td>\n    <td> </td>\n    <td>Expected to find a response of:<div><i>\\{\\}</i></div></td>\n    <td>Found a response of:<div><i>\\{<br/>\\&nbsp;\\&nbsp;\"name\":\\&nbsp;\"john\"<br/>\\}</i></div></td>\n    <td>[0-9]+ms / [0-9]+ms</td>\n    <td class='fail'>Fail</td>\n   </tr>\n"));
}
Also used : Response(com.coveros.selenified.services.Response) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 14 with Response

use of com.coveros.selenified.services.Response in project selenified by Coveros.

the class ResponseTest method checkNewResponseFileMessageTest.

@Test
public void checkNewResponseFileMessageTest() {
    Response response = new Response(new OutputFile("directory", "file", Browser.ANDROID, null, null, null, null, null, null));
    Assert.assertNull(response.getMessage());
}
Also used : Response(com.coveros.selenified.services.Response) OutputFile(com.coveros.selenified.OutputFile) Test(org.testng.annotations.Test)

Example 15 with Response

use of com.coveros.selenified.services.Response in project selenified by Coveros.

the class ResponseTest method checkNewResponseObjectObjectTest.

@Test
public void checkNewResponseObjectObjectTest() {
    JsonObject json = new JsonObject();
    Response response = new Response(5, json, "");
    Assert.assertEquals(response.getObjectData(), json);
}
Also used : Response(com.coveros.selenified.services.Response) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Aggregations

Response (com.coveros.selenified.services.Response)44 Test (org.testng.annotations.Test)44 JsonObject (com.google.gson.JsonObject)24 JsonArray (com.google.gson.JsonArray)17 HashMap (java.util.HashMap)3 OutputFile (com.coveros.selenified.OutputFile)1