package de.retest.recheck;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.Test;

import de.retest.recheck.report.SuiteReplayResult;

class SuiteAggregatorTest {

	@Test
	void get_suite_should_return_a_new_suite_if_current_suite_is_null() throws Exception {
		final String suiteName = "de.retest.foo";
		final SuiteReplayResult currentSuite = SuiteAggregator.getTestInstance().getSuite( suiteName );
		assertThat( currentSuite.getSuiteName() ).isEqualTo( suiteName );
	}

	@Test
	void get_suite_should_return_the_same_object_if_current_suite_is_equal() throws Exception {
		final String suiteName = "de.retest.bar";
		final SuiteAggregator cut = SuiteAggregator.getTestInstance();
		final SuiteReplayResult currentSuite = cut.getSuite( suiteName );
		final SuiteReplayResult nextSuite = cut.getSuite( suiteName );
		assertThat( nextSuite ).isEqualTo( currentSuite );
	}

	@Test
	void get_suite_should_return_next_object_if_current_suite_is_not_equal() throws Exception {
		final String suiteName = "de.retest.foo";
		final String nextSuiteName = "de.retest.bar";
		final SuiteAggregator cut = SuiteAggregator.getTestInstance();
		final SuiteReplayResult currentSuite = cut.getSuite( suiteName );
		final SuiteReplayResult nextSuite = cut.getSuite( nextSuiteName );
		assertThat( currentSuite.getSuiteName() ).isEqualTo( suiteName );
		assertThat( nextSuite.getSuiteName() ).isEqualTo( nextSuiteName );
	}
}

@@ -166,16 +166,60 @@
 yResult;
+%0Aimport de.retest.recheck.report.TestReport;
 %0A%0Aclass 
@@ -1482,11 +1482,572 @@
 me );%0A%09%7D
+%0A%0A%09@Test%0A%09void aggregated_test_report_should_enclose_all_suites() throws Exception %7B%0A%09%09final String suiteName = %22de.retest.foo%22;%0A%09%09final String nextSuiteName = %22de.retest.bar%22;%0A%09%09final SuiteAggregator cut = SuiteAggregator.getTestInstance();%0A%0A%09%09final SuiteReplayResult currentSuite = cut.getSuite( suiteName );%0A%09%09final SuiteReplayResult nextSuite = cut.getSuite( nextSuiteName );%0A%09%09final TestReport aggregatedTestReport = cut.getAggregatedTestReport();%0A%0A%09%09assertThat( aggregatedTestReport.getSuiteReplayResults() ).containsExactly( currentSuite, nextSuite );%0A%09%7D
 %0A%7D%0A

Add test for new method