@@ -111,6 +111,40 @@ public void testMixedCaseParameter(String paramName,
111111 .shouldNotMatch (notExpected );
112112 }
113113
114+ /**
115+ * This will execute the test logic, but first change the param
116+ * to be mixed case
117+ * Additionally it will input a nonsensical input testing if
118+ * the Debug would function identically
119+ *
120+ * @param paramName name of the parameter e.g. -Djava.security.debug=
121+ * @param paramVal value of the parameter
122+ * @param expected expected output
123+ * @param notExpected not expected output
124+ */
125+ public void testMixedCaseBrokenParameter (String paramName ,
126+ String paramVal ,
127+ String notExpected ) throws Exception {
128+
129+ final String formattedParam = makeFirstAndLastLetterUppercase (paramVal );
130+
131+ final String nonsenseParam = formattedParam .substring (0 ,formattedParam .length ()-2 ) +
132+ "NONSENSE" +
133+ formattedParam .substring (formattedParam .length ()-2 );
134+
135+ System .out .printf ("Executing: {%s%s DebugOptions}%n" ,
136+ paramName ,
137+ nonsenseParam );
138+
139+ final OutputAnalyzer outputAnalyzer = ProcessTools .executeTestJava (
140+ paramName + "NONSENSE" + nonsenseParam + "NONSENSE" ,
141+ "DebugOptions" );
142+
143+ // shouldn't fail, but shouldn't give 'properties:' back
144+ outputAnalyzer .shouldHaveExitValue (0 )
145+ .shouldNotMatch (notExpected );
146+ }
147+
114148 /**
115149 * This method will change the input string to have
116150 * first and last letters uppercase
@@ -173,6 +207,44 @@ public void debugOptionsMixedCaseTest() throws Exception {
173207 }
174208 }
175209
210+ /**
211+ * This test will run all options in parallel with all param names
212+ * However all params will be automatically adjusted to be broken
213+ * the expectation is to have a complete execution, but no debug output
214+ */
215+ @ Test
216+ public void debugOptionsBrokenTest () throws Exception {
217+
218+ try (final ExecutorService executorService = Executors .newVirtualThreadPerTaskExecutor ()) {
219+ final List <Callable <Void >> testsCallables = new ArrayList <>();
220+
221+ patternMatches .forEach (params -> {
222+ testsCallables .add (() -> {
223+ testMixedCaseBrokenParameter (
224+ "-Djava.security.debug=" ,
225+ params [0 ],
226+ params [2 ]);
227+ return null ;
228+ });
229+ testsCallables .add (() -> {
230+ testMixedCaseBrokenParameter (
231+ "-Djava.security.auth.debug=" ,
232+ params [0 ],
233+ params [2 ]);
234+ return null ;
235+ });
236+
237+ System .out .println ("Option added to all broken case tests " + Arrays .toString (params ));
238+ });
239+
240+ System .out .println ("Starting all the threads" );
241+ final List <Future <Void >> res = executorService .invokeAll (testsCallables );
242+ for (final Future <Void > future : res ) {
243+ future .get ();
244+ }
245+ }
246+ }
247+
176248 /**
177249 * This is used for the test logic itself
178250 */
0 commit comments