|
7 | 7 | import org.codehaus.plexus.PlexusContainerException;
|
8 | 8 | import org.codehaus.plexus.logging.Logger;
|
9 | 9 | import org.junit.jupiter.api.BeforeAll;
|
| 10 | +import org.junit.jupiter.api.DisplayName; |
10 | 11 | import org.junit.jupiter.api.Test;
|
11 | 12 | import org.junit.jupiter.api.extension.ExtendWith;
|
12 | 13 | import org.mockito.junit.jupiter.MockitoExtension;
|
@@ -90,4 +91,54 @@ void testSetCompleted() {
|
90 | 91 | //TODO see how to unit test this
|
91 | 92 | }
|
92 | 93 |
|
| 94 | + @Test |
| 95 | + void testHideSuccess() { |
| 96 | + //TestStarting parameters |
| 97 | + SimpleReportEntry simpleReportEntry1 = new SimpleReportEntry(RunMode.NORMAL_RUN, 123L, "NestedExampleTest", "Nested Sample", null, null); |
| 98 | + SimpleReportEntry simpleReportEntry2 = new SimpleReportEntry(RunMode.NORMAL_RUN, 123L, "NestedExampleTest$InnerTest", "Inner Test", null, null); |
| 99 | + SimpleReportEntry simpleReportEntry3 = new SimpleReportEntry(RunMode.NORMAL_RUN, 123L, "NestedExampleTest$InnerTest$InnerInnerTest", "Inner Inner Test", null, null); |
| 100 | + SimpleReportEntry simpleReportEntry4 = new SimpleReportEntry(RunMode.NORMAL_RUN, 123L, "NestedExampleTest$InnerTest$InnerInnerTest$InnerInnerInnerTest", "Inner Inner Inner Test", null, null); |
| 101 | + |
| 102 | + SimpleReportEntry firstTest = new SimpleReportEntry(RunMode.NORMAL_RUN, 123L, "NestedExampleTest", "Nested Sample", "test", "Should not be displayed"); |
| 103 | + WrappedReportEntry wrappedReportEntry1 = new WrappedReportEntry(firstTest, ReportEntryType.SUCCESS, 1, stdout, stderr); |
| 104 | + |
| 105 | + SimpleReportEntry secondTest = new SimpleReportEntry(RunMode.NORMAL_RUN, 123L, "NestedExampleTest", "Nested Sample", "test2", "Should not be displayed"); |
| 106 | + WrappedReportEntry wrappedReportEntry2 = new WrappedReportEntry(secondTest, ReportEntryType.SUCCESS, 1, stdout, stderr); |
| 107 | + |
| 108 | + SimpleReportEntry thirdTest = new SimpleReportEntry(RunMode.NORMAL_RUN, 123L, "NestedExampleTest$InnerTest", "Inner Test", "test", "Inner failure test should be displayed"); |
| 109 | + WrappedReportEntry wrappedReportEntry3 = new WrappedReportEntry(thirdTest, ReportEntryType.FAILURE, 1, stdout, stderr); |
| 110 | + |
| 111 | + SimpleReportEntry fourthTest = new SimpleReportEntry(RunMode.NORMAL_RUN, 123L, "NestedExampleTest$InnerTest$InnerInnerTest", "Inner Inner Test", "test", "Inner Inner error test should be displayed"); |
| 112 | + WrappedReportEntry wrappedReportEntry4 = new WrappedReportEntry(fourthTest, ReportEntryType.ERROR, 1, stdout, stderr); |
| 113 | + |
| 114 | + SimpleReportEntry fifthTest = new SimpleReportEntry(RunMode.NORMAL_RUN, 123L, "NestedExampleTest$InnerTest$InnerInnerTest$InnerInnerInnerTest", "Inner Inner Inner Test", "test", "Inner Inner Inner skipped test should be displayed"); |
| 115 | + WrappedReportEntry wrappedReportEntry5 = new WrappedReportEntry(fifthTest, ReportEntryType.SKIPPED, 1, stdout, stderr); |
| 116 | + |
| 117 | + SimpleReportEntry sixthTest = new SimpleReportEntry(RunMode.NORMAL_RUN, 123L, "NestedExampleTest$FirstInnerTest", "First Inner Test", "test", "FirstInnerTest should not be displayed"); |
| 118 | + WrappedReportEntry wrappedReportEntry6 = new WrappedReportEntry(sixthTest, ReportEntryType.SUCCESS, 1, stdout, stderr); |
| 119 | + |
| 120 | + TestSetStats testSetStats = new TestSetStats(false, true); |
| 121 | + testSetStats.testSucceeded(wrappedReportEntry1); |
| 122 | + testSetStats.testSucceeded(wrappedReportEntry2); |
| 123 | + testSetStats.testFailure(wrappedReportEntry3); |
| 124 | + testSetStats.testError(wrappedReportEntry4); |
| 125 | + testSetStats.testSkipped(wrappedReportEntry5); |
| 126 | + testSetStats.testSucceeded(wrappedReportEntry6); |
| 127 | + |
| 128 | + TestSetStats testSetStatsForClass = new TestSetStats(false, true); |
| 129 | + |
| 130 | + ReporterOptions optionsHidingSuccess = ReporterOptions.builder().hideResultsOnSuccess(true).build(); |
| 131 | + ConsoleTreeReporter consoleTreeReporter = new ConsoleTreeReporter(new PluginConsoleLogger(logger), optionsHidingSuccess); |
| 132 | + consoleTreeReporter.testSetStarting(simpleReportEntry1); |
| 133 | + consoleTreeReporter.testSetStarting(simpleReportEntry2); |
| 134 | + consoleTreeReporter.testSetStarting(simpleReportEntry3); |
| 135 | + consoleTreeReporter.testSetStarting(simpleReportEntry4); |
| 136 | + consoleTreeReporter.testSetCompleted(wrappedReportEntry5, testSetStats, null); |
| 137 | + consoleTreeReporter.testSetCompleted(wrappedReportEntry4, testSetStatsForClass, null); |
| 138 | + consoleTreeReporter.testSetCompleted(wrappedReportEntry3, testSetStatsForClass, null); |
| 139 | + consoleTreeReporter.testSetCompleted(wrappedReportEntry2, testSetStatsForClass, null); |
| 140 | + |
| 141 | + } |
| 142 | + |
| 143 | + |
93 | 144 | }
|
0 commit comments