diff --git a/instrumentation/resources/library/src/test/java/io/opentelemetry/instrumentation/resources/ProcessResourceTest.java b/instrumentation/resources/library/src/test/java/io/opentelemetry/instrumentation/resources/ProcessResourceTest.java index cd4aa23d74f9..9fde20d97a72 100644 --- a/instrumentation/resources/library/src/test/java/io/opentelemetry/instrumentation/resources/ProcessResourceTest.java +++ b/instrumentation/resources/library/src/test/java/io/opentelemetry/instrumentation/resources/ProcessResourceTest.java @@ -10,7 +10,6 @@ import io.opentelemetry.api.common.Attributes; import io.opentelemetry.sdk.resources.Resource; import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; -import java.io.File; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; @@ -29,9 +28,7 @@ void notWindows() { Attributes attributes = resource.getAttributes(); assertThat(attributes.get(ResourceAttributes.PROCESS_PID)).isGreaterThan(1); - assertThat(attributes.get(ResourceAttributes.PROCESS_EXECUTABLE_PATH)) - .contains(File.separatorChar + "java") - .doesNotEndWith(".exe"); + assertThat(attributes.get(ResourceAttributes.PROCESS_EXECUTABLE_PATH)).matches(".*[/\\\\]java"); assertThat(attributes.get(ResourceAttributes.PROCESS_COMMAND_LINE)) .contains(attributes.get(ResourceAttributes.PROCESS_EXECUTABLE_PATH)); } @@ -45,8 +42,7 @@ void windows() { assertThat(attributes.get(ResourceAttributes.PROCESS_PID)).isGreaterThan(1); assertThat(attributes.get(ResourceAttributes.PROCESS_EXECUTABLE_PATH)) - .contains(File.separatorChar + "java") - .endsWith(".exe"); + .matches(".*[/\\\\]java\\.exe"); assertThat(attributes.get(ResourceAttributes.PROCESS_COMMAND_LINE)) .contains(attributes.get(ResourceAttributes.PROCESS_EXECUTABLE_PATH)); }