use of com.coveros.selenified.services.Response in project selenified by Coveros.
the class OutputFileTest method formatResponseBothTest.
@Test
public void formatResponseBothTest() {
JsonArray array = new JsonArray();
array.add("world");
Response response = new Response(0, array, null);
JsonObject object = new JsonObject();
object.addProperty("hello", "world");
response.setObjectData(object);
Assert.assertEquals(outputFile.formatResponse(response), "<div><i>[<br/> \"world\"<br/>]{<br/> \"hello\": \"world\"<br/>}</i></div>");
}
use of com.coveros.selenified.services.Response in project selenified by Coveros.
the class OutputFileTest method formatRequestObjectTest.
@Test
public void formatRequestObjectTest() {
JsonObject json = new JsonObject();
json.addProperty("hello", "world");
Response response = new Response(0, json, null);
Assert.assertEquals(outputFile.formatResponse(response), "<div><i>{<br/> \"hello\": \"world\"<br/>}</i></div>");
}
use of com.coveros.selenified.services.Response in project selenified by Coveros.
the class OutputFileTest method formatResponseArrayTest.
@Test
public void formatResponseArrayTest() {
JsonArray json = new JsonArray();
json.add("world");
Response response = new Response(0, json, null);
Assert.assertEquals(outputFile.formatResponse(response), "<div><i>[<br/> \"world\"<br/>]</i></div>");
}
use of com.coveros.selenified.services.Response in project selenified by Coveros.
the class ResponseTest method checkSetMessageTest.
@Test
public void checkSetMessageTest() {
JsonArray json = new JsonArray();
String message = "";
Response response = new Response(5, json, message);
Assert.assertEquals(response.getMessage(), message);
String newMessage = "hello world";
response.setMessage(newMessage);
Assert.assertEquals(response.getMessage(), newMessage);
}
use of com.coveros.selenified.services.Response in project selenified by Coveros.
the class ResponseTest method confirmContainsObjectNullTest.
@Test
public void confirmContainsObjectNullTest() throws IOException {
JsonArray json = new JsonArray();
json.add("name");
Response response = new Response(5, json, "");
response.setOutputFile(outputFile);
JsonObject badChild = new JsonObject();
badChild.addProperty("first", "john");
response.assertContains("name", badChild);
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 with key <i>name</i> equal to: <div><i>\\{<br/>\\ \\ \"first\":\\ \"john\"<br/>\\}</i></div></td>\n <td>Found a response of:<div><i>\\[<br/>\\ \\ \"name\"<br/>\\]</i></div></td>\n <td>[0-9]+ms / [0-9]+ms</td>\n <td class='fail'>Fail</td>\n </tr>\n"));
}
Aggregations