### Question:
RequestStats { public String toString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("Id : ").append(id) .append("\nMethod : ").append(methodType) .append("\nHost : ").append(hostName) .append("\nStatusCode : ").append(statusCode) .append("\nRequest Size : ").append(requestSize) .append("\nResponse Size : ").append(responseSize) .append("\nTime Taken : ").append(endTime - startTime) .append("\nUrl : ").append(url) .append("\nRequest Body : ").append(requestBody) .append("\nResponse Body : ").append(responseBody); return stringBuilder.toString(); } RequestStats(int requestId); String toString(); final int id; public URL url; public String methodType; public long requestSize; public long responseSize; public RequestBody requestBody; public ResponseBody responseBody; public String hostName; public int statusCode; public long startTime; public long endTime; }### Answer:
@Test public void testDataIntegrity() throws MalformedURLException { RequestStats requestStats = new RequestStats(1); requestStats.url = new URL("http: requestStats.requestSize = 20; requestStats.methodType = "POST"; requestStats.responseSize = 40; requestStats.startTime = 2; requestStats.endTime = 3; requestStats.statusCode = 200; requestStats.hostName = "flipkart.com"; Assert.assertTrue(requestStats.id == 1); Assert.assertTrue(requestStats.url.toString().equals("http: Assert.assertTrue(requestStats.requestSize == 20); Assert.assertTrue(requestStats.methodType.equals("POST")); Assert.assertTrue(requestStats.responseSize == 40); Assert.assertTrue(requestStats.startTime == 2); Assert.assertTrue(requestStats.endTime == 3); Assert.assertTrue(requestStats.statusCode == 200); Assert.assertTrue(requestStats.hostName.equals("flipkart.com")); }