package de.retest.recheck.printer;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import org.junit.jupiter.api.Test;

import de.retest.recheck.report.SuiteReplayResult;
import de.retest.recheck.report.TestReplayResult;
import de.retest.recheck.ui.descriptors.GroundState;

class SuiteReplayResultPrinterTest {

	@Test
	void toString_should_not_print_if_no_differences() {
		final SuiteReplayResultPrinter cut = new SuiteReplayResultPrinter( DefaultValueFinderProvider.none() );

		final TestReplayResult emptyTestResult = mock( TestReplayResult.class );
		when( emptyTestResult.isEmpty() ).thenReturn( true );

		final SuiteReplayResult replayResult =
				new SuiteReplayResult( "suite", 0, mock( GroundState.class ), "uuid", mock( GroundState.class ) );
		replayResult.addTest( emptyTestResult );

		assertThat( cut.toString( replayResult ) ).isEqualTo( "Suite 'suite' has 0 difference(s) in 1 test(s):\n" );
	}
}

@@ -179,36 +179,119 @@
 ort 
-org.junit.jupiter.api.Test;%0A
+java.util.Collections;%0A%0Aimport org.junit.jupiter.api.Test;%0A%0Aimport de.retest.recheck.report.ActionReplayResult;
 %0Aimp
@@ -440,16 +440,66 @@
 ndState;
+%0Aimport de.retest.recheck.ui.diff.StateDifference;
 %0A%0Aclass 
@@ -1131,11 +1131,1446 @@
 n%22 );%0A%09%7D
+%0A%0A%09@Test%0A%09void toString_with_indent_should_not_print_if_no_differences() %7B%0A%09%09final SuiteReplayResultPrinter cut = new SuiteReplayResultPrinter( DefaultValueFinderProvider.none() );%0A%0A%09%09final SuiteReplayResult replayResult =%0A%09%09%09%09new SuiteReplayResult( %22suite%22, 0, mock( GroundState.class ), %22uuid%22, mock( GroundState.class ) );%0A%0A%09%09assertThat( cut.toString( replayResult, %22____%22 ) ).startsWith( %22____%22 );%0A%09%7D%0A%0A%09@Test%0A%09void toString_should_print_test_properly_indented() throws Exception %7B%0A%09%09final SuiteReplayResultPrinter cut = new SuiteReplayResultPrinter( DefaultValueFinderProvider.none() );%0A%0A%09%09final ActionReplayResult actionResult = mock( ActionReplayResult.class );%0A%09%09when( actionResult.hasDifferences() ).thenReturn( true );%0A%09%09when( actionResult.getStateDifference() ).thenReturn( mock( StateDifference.class ) );%0A%0A%09%09final TestReplayResult testResult = mock( TestReplayResult.class );%0A%09%09when( testResult.isEmpty() ).thenReturn( false );%0A%09%09when( testResult.getActionReplayResults() ).thenReturn( Collections.singletonList( actionResult ) );%0A%0A%09%09final SuiteReplayResult replayResult =%0A%09%09%09%09new SuiteReplayResult( %22suite%22, 0, mock( GroundState.class ), %22uuid%22, mock( GroundState.class ) );%0A%09%09replayResult.addTest( testResult );%0A%0A%09%09assertThat( cut.toString( replayResult ) ).isEqualTo( %22Suite 'suite' has 0 difference(s) in 1 test(s):%5Cn%22 //%0A%09%09%09%09+ %22%5CtTest 'null' has 0 difference(s) in 1 state(s):%5Cn%22 //%0A%09%09%09%09+ %22%5Ctnull resulted in:%5Cn%22 );%0A%09%7D
 %0A%7D%0A

Add tests for SuiteReplayResultPrinter