private Iterable<TestResult> pruneToDepth(List<TestResult> results, Integer depth) { // Prune the response to the requested depth // 0 - TestResult // 1 - TestCapability // 2 - TestSuite // 3 - TestCase // 4 - Entire response // null - Entire response if (depth == null || depth > 3) { return results; } for (TestResult result : results) { if (depth == 0) { result.getTestCapabilities().clear(); } else { for (TestCapability testCapability : result.getTestCapabilities()) { if (depth == 1) { testCapability.getTestSuites().clear(); } else { for (TestSuite testSuite : testCapability.getTestSuites()) { if (depth == 2) { testSuite.getTestCases().clear(); } else { // depth == 3 for (TestCase testCase : testSuite.getTestCases()) { testCase.getTestSteps().clear(); } } } } } } } return results; }
private void assertTestCase( TestCase tc, String id, String name, long duration, TestCaseStatus status) { assertThat(tc.getId(), is(id)); assertThat(tc.getDescription(), is(name)); assertThat(tc.getDuration(), is(duration)); assertThat(tc.getStatus(), is(status)); }