@Override
    public final void onFinish(final ITestContext pTestContext) {

        super.onFinish(pTestContext);

        // List of test results which we will delete later
        final List<ITestResult> testsToBeRemoved = new ArrayList<ITestResult>();

        // collect all id's from passed test
        final Set<Integer> passedTestIds = new HashSet<Integer>();
        for (final ITestResult passedTest : pTestContext.getPassedTests().getAllResults()) {
            passedTestIds.add(getId(passedTest));
        }

        final Set<Integer> failedTestIds = new HashSet<Integer>();
        for (final ITestResult failedTest : pTestContext.getFailedTests().getAllResults()) {

            // id = class + method + dataprovider
            final int failedTestId = getId(failedTest);

            // if we saw this test as a failed test before we mark as to be deleted
            // or delete this failed test if there is at least one passed version
            if (failedTestIds.contains(failedTestId) || passedTestIds.contains(failedTestId)) {
                testsToBeRemoved.add(failedTest);
            } else {
                failedTestIds.add(failedTestId);
            }
        }

        // finally delete all tests that are marked
        for (final Iterator<ITestResult> iterator = pTestContext.getFailedTests().getAllResults().iterator(); iterator.hasNext();) {
            final ITestResult testResult = iterator.next();
            if (testsToBeRemoved.contains(testResult)) {
                iterator.remove();
            }
        }

        // TNG: force SKIP state for skipped tests
        for (final ITestResult r : pTestContext.getSkippedTests().getAllResults()) {
            if (r.getStatus() != ITestResult.SKIP) {
                r.setStatus(ITestResult.SKIP);
            }
        }
    }