4242import jdk .test .lib .process .OutputAnalyzer ;
4343import jdk .test .lib .process .ProcessTools ;
4444
45+ import org .junit .jupiter .api .Assumptions ;
46+
4547public class TestProperties {
4648
4749 private static Stream <Arguments > patternMatches_expectedExitValue0 () {
@@ -227,6 +229,11 @@ public void shouldContain_expectedExitValue1(String customprofile, String securi
227229 @ MethodSource ("patternMatches_propertiesList" )
228230 public void shouldContain_propertiesList (String customprofile , String securityPropertyFileList ,
229231 String expected , int exitValue ) throws Exception {
232+ // Skip tests if OpenJCEPlusFIPS is not available.
233+ boolean hasOpenJCEPlus = isProviderPresent ("OpenJCEPlusFIPS" );
234+ Assumptions .assumeTrue (hasOpenJCEPlus ,
235+ "Skipping: OpenJCEPlus provider is not present in this runtime." );
236+
230237 OutputAnalyzer outputAnalyzer = ProcessTools .executeTestJava (
231238 "-Dsemeru.fips=true" ,
232239 "-Dsemeru.customprofile=" + customprofile ,
@@ -236,6 +243,15 @@ public void shouldContain_propertiesList(String customprofile, String securityPr
236243 outputAnalyzer .shouldHaveExitValue (exitValue ).shouldMatch (expected );
237244 }
238245
246+ private boolean isProviderPresent (String providerName ) {
247+ for (Provider p : Security .getProviders ()) {
248+ if (p .getName ().equalsIgnoreCase (providerName )) {
249+ return true ;
250+ }
251+ }
252+ return false ;
253+ }
254+
239255 public static void main (String [] args ) {
240256 // Something to trigger "properties" debug output.
241257 try {
0 commit comments