private void printResultSummary(FixtureDeclarations fixtureDeclarations, String example, ResultSummary resultSummary, String additionalInformation) { synchronized (System.out) { if (additionalInformation != null) { System.out.print(additionalInformation); } resultSummary.print(System.out, fixtureDeclarations); resultSummary.assertIsSatisfied(fixtureDeclarations); } }
@Override public void assertIsSatisfied(ResultSummary rs, FailFastException ffe) { if (rs.getIgnoredCount() != 1 || rs.getSuccessCount() + rs.getFailureCount() + rs.getExceptionCount() > 0 || ffe != null) { throw new ConcordionAssertionError("Example is expected to be ignored but is currently reporting.", rs); } }
@Override public ResultSummary convertForCache(ResultSummary rs) { try { assertIsSatisfied(rs, null); return new SingleResultSummary(Result.IGNORED, rs.getSpecificationDescription()); } catch (ConcordionAssertionError cce) { return new SingleResultSummary(Result.FAILURE, rs.getSpecificationDescription()); } }
@Override public void assertIsSatisfied(ResultSummary rs, FailFastException ffe) { if (rs.getFailureCount() + rs.getExceptionCount() == 0) { throw new ConcordionAssertionError("Specification is expected to fail but has neither failures nor exceptions.", rs); } }
@Override public void assertIsSatisfied(ResultSummary rs, FailFastException ffe) { List<String> list = new ArrayList<String>(); addToList(list, rs.getSuccessCount(), "a success", "some successes"); addToList(list, rs.getFailureCount(), "a failure", "some failures"); addToList(list, rs.getExceptionCount(), "an exception", "some exceptions"); if (list.size() > 0) { StringBuilder s = new StringBuilder(); s.append(list.get(0)); if (list.size() > 1) { for (int i = 1; i < (list.size() - 1); i++) { s.append(", ").append(list.get(i)); } s.append(", and ").append(list.get(list.size() - 1)); } throw new ConcordionAssertionError("Specification is supposed to be unimplemented, but is reporting " + s + ".", rs); } }
public void announce(ResultSummary result) { synchronized(resource) { if (result.getFailureCount() + result.getExceptionCount() > 0) { announceFailure(element, result); } else if (result.getIgnoredCount() > 0) { announceIgnored(element, result); } else { announceSuccess(element, result); } } }
/** * * This method is deprecated as it's only used in jUnit 3. * * @param fixture fixture * @return result summary * @throws IOException on io error */ @Deprecated public ResultSummary run(Fixture fixture) throws IOException { RunOutput results = RunResultsCache.SINGLETON.getFromCache(fixture.getFixtureType(), null); ResultSummary resultSummary = run(null, fixture); // only actually finish the specification if it has not already been run. if (results == null) { concordion.finish(); } resultSummary.print(System.out, fixture.getFixtureType()); return resultSummary; } }
void invoke(ConcordionFrameworkMethod concordionFrameworkMethod, Object target) throws Exception { // create the new fixture because there is a new fixture object. Fixture fixture = createFixture(target); String example = concordionFrameworkMethod.getExampleName(); // check the fail fast condition if (failFastException != null) { throw failFastException; } try { ResultSummary result = fixtureRunner.run(example, fixture); result.assertIsSatisfied(fixture.getFixtureType()); } catch (ConcordionAssertionError e) { throw e; } catch (FailFastException e){ failFastException = e; throw e; } catch (IOException e) { throw e; } }
actualResultSummary = concordion.processExample(fixture, example); statusChecker = ImplementationStatusChecker.getImplementationStatusChecker( fixtureType, actualResultSummary.getImplementationStatus()); } finally { fixture.afterProcessExample(example); if (actualResultSummary.isForExample()) { printResultSummary(fixtureType, example, actualResultSummary, additionalInformation);
public long getExceptionCount() { return resultSummary.getExceptionCount(); }
public long getFailureCount() { return resultSummary.getFailureCount(); }
public long getSuccessCount() { return resultSummary.getSuccessCount(); }
public long getIgnoredCount() { return resultSummary.getIgnoredCount(); }
@Override public void assertIsSatisfied(ResultSummary rs, FailFastException ffe) { List<String> list = new ArrayList<String>(); addToList(list, rs.getSuccessCount(), "a success", "some successes"); addToList(list, rs.getFailureCount(), "a failure", "some failures"); addToList(list, rs.getExceptionCount(), "an exception", "some exceptions"); if (list.size() > 0) { StringBuilder s = new StringBuilder(); s.append(list.get(0)); if (list.size() > 1) { for (int i = 1; i < (list.size() - 1); i++) { s.append(", ").append(list.get(i)); } s.append(", and ").append(list.get(list.size() - 1)); } throw new ConcordionAssertionError("Specification is supposed to be unimplemented, but is reporting " + s + ".", rs); } }
@Override public void assertIsSatisfied(ResultSummary rs, FailFastException ffe) { if (rs.getFailureCount() + rs.getExceptionCount() == 0) { throw new ConcordionAssertionError("Specification is expected to fail but has neither failures nor exceptions.", rs); } }
public void announce(ResultSummary result) { synchronized(resource) { if (result.getFailureCount() + result.getExceptionCount() > 0) { announceFailure(element, result); } else if (result.getIgnoredCount() > 0) { announceIgnored(element, result); } else { announceSuccess(element, result); } } }
/** * * This method is deprecated as it's only used in jUnit 3. * * @param fixture fixture * @return result summary * @throws IOException on io error */ @Deprecated public ResultSummary run(Fixture fixture) throws IOException { RunOutput results = RunResultsCache.SINGLETON.getFromCache(fixture.getFixtureType(), null); ResultSummary resultSummary = run(null, fixture); // only actually finish the specification if it has not already been run. if (results == null) { concordion.finish(); } resultSummary.print(System.out, fixture.getFixtureType()); return resultSummary; } }
void invoke(ConcordionFrameworkMethod concordionFrameworkMethod, Object target) throws Exception { // create the new fixture because there is a new fixture object. Fixture fixture = createFixture(target); String example = concordionFrameworkMethod.getExampleName(); // check the fail fast condition if (failFastException != null) { throw failFastException; } try { ResultSummary result = fixtureRunner.run(example, fixture); result.assertIsSatisfied(fixture.getFixtureType()); } catch (ConcordionAssertionError e) { throw e; } catch (FailFastException e){ failFastException = e; throw e; } catch (IOException e) { throw e; } }
actualResultSummary = concordion.processExample(fixture, example); statusChecker = ImplementationStatusChecker.getImplementationStatusChecker( fixtureType, actualResultSummary.getImplementationStatus()); } finally { fixture.afterProcessExample(example); if (actualResultSummary.isForExample()) { printResultSummary(fixtureType, example, actualResultSummary, additionalInformation);
@Override public void assertIsSatisfied(ResultSummary rs, FailFastException ffe) { if (rs.getIgnoredCount() != 1 || rs.getSuccessCount() + rs.getFailureCount() + rs.getExceptionCount() > 0 || ffe != null) { throw new ConcordionAssertionError("Example is expected to be ignored but is currently reporting.", rs); } }