Skip to content

Commit

Permalink
only test java.home
Browse files Browse the repository at this point in the history
  • Loading branch information
erwan-serandour committed Oct 29, 2024
1 parent f6fd6c1 commit 21e0180
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions its/src/test/java/com/sonar/maven/it/suite/JavaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,10 @@ void setJavaVersionProperties() throws IOException {
@Test
void when_java_home_exists_it_is_used_as_default_sonar_java_jdkHome_value() throws IOException {
//verify that property java home exists, it may not be pointing to a jdk
Assumptions.assumeTrue(System.getProperties().containsKey("java.home")
|| System.getenv().containsKey("JAVA_HOME"));
Assumptions.assumeTrue(System.getProperties().containsKey("java.home"));


//fix java.home and JAVA_HOME, the plugin should not modify them
//fix value, the plugin should not modify them
String javaHomeSystem = System.getProperty("java.home");
String javaHomeEnv = System.getenv().get("JAVA_HOME");


File outputProps = temp.resolve("out.properties").toFile();
Expand All @@ -146,7 +143,7 @@ void when_java_home_exists_it_is_used_as_default_sonar_java_jdkHome_value() thro
Properties props = getProps(outputProps);
String jdkHome = props.getProperty("sonar.java.jdkHome");
//the jdk is not configured in the project, so default value should be used
assertThat(jdkHome).isIn(Arrays.asList(javaHomeSystem, javaHomeEnv));
assertThat(jdkHome).isIn(Arrays.asList(javaHomeSystem));
}

@Test
Expand Down

0 comments on commit 21e0180

Please sign in to comment.