use of com.coveros.selenified.services.Response in project selenified by Coveros.
the class ResponseTest method checkNewResponseCodeArrayTest.
@Test
public void checkNewResponseCodeArrayTest() {
Response response = new Response(5);
Assert.assertNull(response.getArrayData());
}
use of com.coveros.selenified.services.Response in project selenified by Coveros.
the class ResponseTest method confirmContainsPairsFailsTest.
@Test
public void confirmContainsPairsFailsTest() throws IOException {
JsonObject json = new JsonObject();
json.addProperty("name", "john");
Response response = new Response(5, json, "");
response.setOutputFile(outputFile);
Map<String, String> pairs = new HashMap<>();
pairs.put("name1", "john");
response.assertContains(pairs);
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 containing: <div><i><div>name1 : john</div></i></div></td>\n <td>Found a response of:<div><i>\\{<br/>\\ \\ \"name\":\\ \"john\"<br/>\\}</i></div></td>\n <td>[0-9]+ms / [0-9]+ms</td>\n <td class='fail'>Fail</td>\n </tr>\n"));
}
use of com.coveros.selenified.services.Response in project selenified by Coveros.
the class ResponseTest method confirmContainsArrayFailTest.
@Test
public void confirmContainsArrayFailTest() throws IOException {
JsonObject child = new JsonObject();
child.addProperty("first", "john");
child.addProperty("last", "smith");
JsonArray json = new JsonArray();
json.add(child);
Response response = new Response(5, json, "");
response.setOutputFile(outputFile);
JsonObject badChild = new JsonObject();
badChild.addProperty("first", "john");
response.assertContains(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 containing:<div><i>\\{<br/>\\ \\ \"first\":\\ \"john\"<br/>\\}</i></div></td>\n <td>Found a response of:<div><i>\\[<br/> \\{<br/>\\ \\ \\ \\ \"first\":\\ \"john\",<br/>\\ \\ \\ \\ \"last\":\\ \"smith\"<br/>\\ \\ \\}<br/>\\]</i></div></td>\n <td>[0-9]+ms / [0-9]+ms</td>\n <td class='fail'>Fail</td>\n </tr>\n"));
}
use of com.coveros.selenified.services.Response in project selenified by Coveros.
the class ResponseTest method confirmContainsObjectPassTest.
@Test
public void confirmContainsObjectPassTest() throws IOException {
JsonObject child = new JsonObject();
child.addProperty("first", "john");
child.addProperty("last", "smith");
JsonObject json = new JsonObject();
json.add("name", child);
Response response = new Response(5, json, "");
response.setOutputFile(outputFile);
response.assertContains("name", child);
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/>\\ \\ \"last\":\\ \"smith\"<br/>\\}</i></div></td>\n <td>Found a response of:<div><i>\\{<br/>\\ \\ \"name\":\\ \\{<br/>\\ \\ \\ \\ \"first\":\\ \"john\",<br/>\\ \\ \\ \\ \"last\":\\ \"smith\"<br/>\\ \\ \\}<br/>}</i></div></td>\n <td>[0-9]+ms / [0-9]+ms</td>\n <td class='pass'>Pass</td>\n </tr>\n"));
}
use of com.coveros.selenified.services.Response in project selenified by Coveros.
the class ResponseTest method checkSetFileTest.
@Test
public void checkSetFileTest() {
Response response = new Response(outputFile);
response.setOutputFile(outputFile);
// just ensure no errors are thrown
}
Aggregations