8000 Add test for improved messages · comtef/dd-trace-java@ce26d05 · GitHub
[go: up one dir, main page]

Skip to content

Commit ce26d05

Browse files
committed
Add test for improved messages
1 parent 343a77d commit ce26d05

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

dd-java-agent/agent-profiling/profiling-controller/src/test/java/com/datadog/profiling/controller/ControllerFactoryTest.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.datadog.profiling.controller;
22

3+
import static org.junit.jupiter.api.Assertions.assertEquals;
34
import static org.junit.jupiter.api.Assertions.assertThrows;
45
import static org.junit.jupiter.api.condition.JRE.JAVA_8;
56

@@ -19,10 +20,18 @@ public class ControllerFactoryTest {
1920
@Test
2021
@EnabledOnJre({JAVA_8})
2122
public void testCreateControllerJava8() {
22-
assertThrows(
23-
UnsupportedEnvironmentException.class,
24-
() -> {
25-
ControllerFactory.createController(config);
26-
});
23+
System.out.println("Java Version: " + System.getProperty("java.version") + " " + System.getProperty("java.vendor"));
24+
UnsupportedEnvironmentException unsupportedEnvironmentException = assertThrows(
25+
UnsupportedEnvironmentException.class,
26+
() -> {
27+
ControllerFactory.createController(config);
28+
});
29+
System.out.println(unsupportedEnvironmentException.getMessage());
30+
System.out.println(System.getProperty("java.vendor"));
31+
String expected = "The JFR controller could not find a supported JFR API, use OpenJDK 11+ or Azul zulu version 1.8.0_212+";
32+
if ("Azul Systems, Inc.".equals(System.getProperty("java.vendor"))) {
33+
expected = "The JFR controller could not find a supported JFR API, use Azul zulu version 1.8.0_212+";
34+
}
35+
assertEquals(expected, unsupportedEnvironmentException.getMessage());
2736
}
2837
}

0 commit comments

Comments
 (0)
0