File tree Expand file tree Collapse file tree 3 files changed +63
-7
lines changed
pitest-entry/src/test/java/org/pitest/mutationtest Expand file tree Collapse file tree 3 files changed +63
-7
lines changed Original file line number Diff line number Diff line change 11package org .pitest .mutationtest .autoconfig ;
22
33import org .junit .Test ;
4+ import org .pitest .mutationtest .config .ConfigUpdaterVerifier ;
45import org .pitest .mutationtest .config .ReportOptions ;
56
67import static org .assertj .core .api .Assertions .assertThat ;
78
89public class EnableAssertionsTest {
910 EnableAssertions underTest = new EnableAssertions ();
1011
12+ ConfigUpdaterVerifier v = ConfigUpdaterVerifier .confirmFactory (underTest );
13+
1114 @ Test
1215 public void addsEAFlag () {
1316 ReportOptions data = new ReportOptions ();
@@ -23,6 +26,11 @@ public void featureIsNamedAutoAssertions() {
2326
2427 @ Test
2528 public void featureIsOnByDefault () {
26- assertThat (underTest .provides ().isOnByDefault ()).isTrue ();
29+ v .isOnByDefault ();
30+ }
31+
32+ @ Test
33+ public void isOnChain () {
34+ v .isOnChain ();
2735 }
2836}
Original file line number Diff line number Diff line change 11package org .pitest .mutationtest .autoconfig ;
22
33import org .junit .Test ;
4+ import org .pitest .mutationtest .config .ConfigUpdaterVerifier ;
45import org .pitest .mutationtest .config .ReportOptions ;
56import org .pitest .plugin .FeatureSetting ;
67
910public class KeepMacOsFocusTest {
1011 KeepMacOsFocus underTest = new KeepMacOsFocus ();
1112
13+ ConfigUpdaterVerifier v = ConfigUpdaterVerifier .confirmFactory (underTest );
14+
1215 @ Test
1316 public void addsHeadlessTrueToJvmArgs () {
1417 ReportOptions data = new ReportOptions ();
@@ -18,16 +21,17 @@ public void addsHeadlessTrueToJvmArgs() {
1821 }
1922
2023 @ Test
21- public void featureIsNamedMacOsFocus () {
22- KeepMacOsFocus underTest = new KeepMacOsFocus ();
24+ public void isOnChain () {
25+ v .isOnChain ();
26+ }
2327
24- assertThat (underTest .provides ().name ()).isEqualTo ("macos_focus" );
28+ @ Test
29+ public void featureIsNamedMacOsFocus () {
30+ v .featureName ().isEqualTo ("macos_focus" );
2531 }
2632
2733 @ Test
2834 public void featureIsOnByDefault () {
29- KeepMacOsFocus underTest = new KeepMacOsFocus ();
30-
31- assertThat (underTest .provides ().isOnByDefault ()).isTrue ();
35+ v .isOnByDefault ();
3236 }
3337}
Original file line number Diff line number Diff line change 1+ package org .pitest .mutationtest .config ;
2+
3+ import org .assertj .core .api .AbstractStringAssert ;
4+ import java .util .List ;
5+ import java .util .stream .Collectors ;
6+
7+ import static org .assertj .core .api .Assertions .assertThat ;
8+
9+ public class ConfigUpdaterVerifier {
10+ private final ConfigurationUpdater factory ;
11+
12+ public ConfigUpdaterVerifier (ConfigurationUpdater factory ) {
13+ this .factory = factory ;
14+ }
15+
16+ public static ConfigUpdaterVerifier confirmFactory (ConfigurationUpdater factory ) {
17+ return new ConfigUpdaterVerifier (factory );
18+ }
19+
20+ public void isOnChain () {
21+ factoryIsOnChain (factory .getClass ());
22+ }
23+
24+ public void isOnByDefault () {
25+ assertThat (factory .provides ().isOnByDefault ()).isTrue ();
26+ }
27+
28+ public void isOffByDefault () {
29+ assertThat (factory .provides ().isOnByDefault ()).isFalse ();
30+ }
31+
32+ public AbstractStringAssert <?> featureName () {
33+ return assertThat (factory .provides ().name ());
34+ }
35+
36+ private static void factoryIsOnChain (Class <?> factory ) {
37+ List <Class <?>> allInterceptors = PluginServices .makeForContextLoader ().findConfigurationUpdaters ().stream ()
38+ .map (ConfigurationUpdater ::getClass )
39+ .collect (Collectors .toList ());
40+
41+ assertThat (allInterceptors ).contains (factory );
42+ }
43+
44+ }
You can’t perform that action at this time.
0 commit comments