public void testOneResult() throws Exception { FitProtocol.writeData(result1.toString(), output); FitProtocol.writeCounts(new Counts(0, 0, 0, 0), output); responder.processResults(input); assertEquals(1, formatter.results.size()); assertEquals(result1.toString(), formatter.results.get(0).toString()); }
public void testMakeResponse() throws Exception { MockRequest request = new MockRequest(); ByteArrayOutputStream output = new ByteArrayOutputStream(); FitProtocol.writeData(result1.toString(), output); FitProtocol.writeData(result2.toString(), output); FitProtocol.writeCounts(new Counts(5, 5, 5, 5), output); request.addInput("results", output.toString()); Response response = responder.makeResponse(context, request); MockResponseSender sender = new MockResponseSender(); sender.doSending(response); String content = sender.sentData(); assertSubString("Mock Results", content); }
public void testFinalCounts() throws Exception { FitProtocol.writeData(result1.toString(), output); Counts counts = new Counts(1, 2, 3, 4); FitProtocol.writeCounts(counts, output); responder.processResults(input); TestSummary summary = formatter.finalSummary; assertEquals(counts.right, summary.getRight()); assertEquals(counts.wrong, summary.getWrong()); assertEquals(counts.ignores, summary.getIgnores()); assertEquals(counts.exceptions, summary.getExceptions()); }