All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.alkedr.matchers.reporting.MergingMatcher Maven / Gradle / Ivy

package com.github.alkedr.matchers.reporting;

import com.github.alkedr.matchers.reporting.reporters.CloseableSafeTreeReporter;
import com.github.alkedr.matchers.reporting.reporters.Reporters;
import com.github.alkedr.matchers.reporting.reporters.SafeTreeReporter;

class MergingMatcher extends BaseReportingMatcher {
    private final ReportingMatcher reportingMatcher;

    MergingMatcher(ReportingMatcher reportingMatcher) {
        this.reportingMatcher = reportingMatcher;
    }

    @Override
    public void run(Object item, SafeTreeReporter safeTreeReporter) {
        try (CloseableSafeTreeReporter mergingReporter = Reporters.mergingReporter(safeTreeReporter)) {
            reportingMatcher.run(item, mergingReporter);
        }
    }

    @Override
    public void runForAbsentItem(SafeTreeReporter safeTreeReporter) {
        try (CloseableSafeTreeReporter mergingReporter = Reporters.mergingReporter(safeTreeReporter)) {
            reportingMatcher.runForAbsentItem(mergingReporter);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy