Skip to content

Commit

Permalink
. dt document currently supported Reporters when using EnvironmentalV…
Browse files Browse the repository at this point in the history
…ariableReporter
  • Loading branch information
LarsEckart committed Aug 12, 2024
1 parent c7fb16a commit bf30864
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import org.approvaltests.Approvals;
import org.approvaltests.core.Options;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class EnvironmentVariableReporterTest
{
Expand All @@ -26,4 +27,11 @@ public void testEnvironmentVariable()
EnvironmentVariableReporter.ENVIRONMENT_VARIABLES = System::getenv;
}
}
@Test
void testValidEnvironmentalValues()
{
Set<String> reporters = new EnvironmentVariableReporter().getReporterMapping().keySet();
List<String> sortedReporters = reporters.stream().sorted().collect(Collectors.toList());
Approvals.verifyAll("", sortedReporters, x -> x);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
AraxisMergeReporter
AutoApproveReporter
AutoApproveWhenEmptyReporter
BeyondCompareReporter
ClipboardReporter
CodeCompareReporter
DelayedClipboardReporter
DiffMergeReporter
DiffReporter
FileCaptureReporter
ImageReporter
ImageWebReporter
IntelliJReporter
JunitReporter
KDiff3Reporter
KaleidoscopeDiffReporter
MeldMergeReporter
P4MergeReporter
PitReporter
QuietReporter
TestNgReporter
TextWebReporter
TkDiffReporter
TortoiseDiffReporter
VisualStudioCodeReporter
WinMergeReporter
WindowsDiffReporter
30 changes: 1 addition & 29 deletions approvaltests/docs/how_to/ConfigureReporters.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,35 +91,7 @@ Lastly, it is possible to set the `APPROVAL_TESTS_USE_REPORTER` environment vari

The environment variable can take any combination of the following values. Multiple values should be separated by a comma, without whitespace.

```java
"AraxisMergeReporter",
"AutoApproveReporter",
"AutoApproveWhenEmptyReporter",
"BeyondCompareReporter",
"ClipboardReporter",
"CodeCompareReporter",
"DelayedClipboardReporter",
"DiffMergeReporter",
"DiffReporter",
"FileCaptureReporter",
"ImageReporter",
"ImageWebReporter",
"IntelliJReporter",
"JunitReporter",
"KDiff3Reporter",
"KaleidoscopeDiffReporter",
"MeldMergeReporter",
"P4MergeReporter",
"PitReporter",
"QuietReporter",
"TestNgReporter",
"TextWebReporter",
"TkDiffReporter",
"TortoiseDiffReporter",
"VisualStudioCodeReporter",
"WinMergeReporter",
"WindowsDiffReporter",
```
snippets: EnvironmentVariableReporterTest.testValidEnvironmentalValues.approved.txt

For example, setting `APPROVAL_TESTS_USE_REPORTER=AutoApproveReporter` allows you to approve all pending changes at once
without modifying the source code and rebuilding the code to temporarily choose a different reporter. Similarly, setting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,8 @@ public boolean report(String received, String approved)
{ return false; }
return reporter.report(received, approved);
}
public Map<String, Class> getReporterMapping()
{
return new HashMap<>(REPORTER_MAP);
}
}

0 comments on commit bf30864

Please sign in to comment.