<commit_before>package de.retest.recheck.printer;

import java.util.function.Function;
import java.util.stream.Collectors;

import de.retest.recheck.ignore.ShouldIgnore;
import de.retest.recheck.report.ActionReplayResult;
import de.retest.recheck.report.TestReplayResult;
import de.retest.recheck.ui.DefaultValueFinder;

public class TestReplayResultPrinter implements Printer<TestReplayResult> {

	private final Function<String, DefaultValueFinder> defaultValueFinder;
	private final ShouldIgnore ignore;

	public TestReplayResultPrinter( final Function<String, DefaultValueFinder> defaultValueFinder,
			final ShouldIgnore ignore ) {
		this.defaultValueFinder = defaultValueFinder;
		this.ignore = ignore;
	}

	@Override
	public String toString( final TestReplayResult difference, final String indent ) {
		final String status = indent + testResult( difference );
		final String differences = difference.getActionReplayResults().stream() //
				.map( a -> formatAction( a, indent ) ) //
				.collect( Collectors.joining( "\n" ) );
		return status + "\n" + differences;
	}

	private String testResult( final TestReplayResult result ) {
		final String name = result.getName();
		final int differences = result.getDifferencesCount();
		final int unique = result.getDifferences( ignore ).size();
		return String.format( "Test '%s' has %d differences (%d unique):", name, differences, unique );
	}

	private String formatAction( final ActionReplayResult result, final String indent ) {
		final DefaultValueFinder finder = defaultValueFinder.apply( result.getDescription() );
		final ActionReplayResultPrinter printer = new ActionReplayResultPrinter( finder, ignore );
		return printer.toString( result, indent );
	}
}<commit_msg>Fix faulty output with "unique" differences<commit_after>package de.retest.recheck.printer;

import java.util.function.Function;
import java.util.stream.Collectors;

import de.retest.recheck.ignore.ShouldIgnore;
import de.retest.recheck.report.ActionReplayResult;
import de.retest.recheck.report.TestReplayResult;
import de.retest.recheck.ui.DefaultValueFinder;

public class TestReplayResultPrinter implements Printer<TestReplayResult> {

	private final Function<String, DefaultValueFinder> defaultValueFinder;
	private final ShouldIgnore ignore;

	public TestReplayResultPrinter( final Function<String, DefaultValueFinder> defaultValueFinder,
			final ShouldIgnore ignore ) {
		this.defaultValueFinder = defaultValueFinder;
		this.ignore = ignore;
	}

	@Override
	public String toString( final TestReplayResult difference, final String indent ) {
		final String status = indent + testResult( difference );
		final String differences = difference.getActionReplayResults().stream() //
				.map( a -> formatAction( a, indent ) ) //
				.collect( Collectors.joining( "\n" ) );
		return status + "\n" + differences;
	}

	private String testResult( final TestReplayResult result ) {
		final String name = result.getName();
		final int differences = result.getDifferences( ignore ).size();
		return String.format( "Test '%s' has %d differences:", name, differences );
	}

	private String formatAction( final ActionReplayResult result, final String indent ) {
		final DefaultValueFinder finder = defaultValueFinder.apply( result.getDescription() );
		final ActionReplayResultPrinter printer = new ActionReplayResultPrinter( finder, ignore );
		return printer.toString( result, indent );
	}
}
{'fraction_non_alphanumeric': 0.09527997654646732, 'fraction_numerical': 0.0, 'mean_word_length': 5.425612052730696, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4154657', 'n_tokens_mistral': 978, 'n_tokens_neox': 939, 'n_words': 258}