From 4bc2c2602f22c4d93fbea6bc8a5e98d0ba251805 Mon Sep 17 00:00:00 2001 From: jason plumb <75337021+breedx-splk@users.noreply.github.com> Date: Fri, 19 Apr 2024 12:42:40 -0700 Subject: [PATCH] Remove commons lang (#1813) * remove dep on commons-lang * spotless * simplify joinery --- custom/build.gradle.kts | 2 -- .../TruncateCommandLineWhenMetricsEnabledTest.java | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/custom/build.gradle.kts b/custom/build.gradle.kts index e91d4ede2..b99ca11b4 100644 --- a/custom/build.gradle.kts +++ b/custom/build.gradle.kts @@ -26,8 +26,6 @@ dependencies { testImplementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api") testImplementation("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api") testImplementation("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling") - testImplementation("org.apache.commons:commons-lang3:3.14.0") - testImplementation(project(":testing:common")) } diff --git a/custom/src/test/java/com/splunk/opentelemetry/TruncateCommandLineWhenMetricsEnabledTest.java b/custom/src/test/java/com/splunk/opentelemetry/TruncateCommandLineWhenMetricsEnabledTest.java index f42989668..25885c383 100644 --- a/custom/src/test/java/com/splunk/opentelemetry/TruncateCommandLineWhenMetricsEnabledTest.java +++ b/custom/src/test/java/com/splunk/opentelemetry/TruncateCommandLineWhenMetricsEnabledTest.java @@ -32,7 +32,6 @@ import io.opentelemetry.sdk.resources.Resource; import java.util.Arrays; import java.util.function.BiFunction; -import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -91,7 +90,7 @@ void truncatesWhenTooLong() { assertThat(resultCmd.length()).isEqualTo(255); assertThat(resultCmd.endsWith("...")).isTrue(); var cmdArgs = result.getAttribute(PROCESS_COMMAND_ARGS); - String joinedArgs = StringUtils.joinWith(", ", cmdArgs.toArray()); + String joinedArgs = String.join(", ", cmdArgs.toArray(new String[] {})); assertThat(joinedArgs.length()).isLessThan(255); assertThat(joinedArgs.endsWith("...")).isTrue(); assertThat(result.getAttribute(stringKey("foo"))).isEqualTo("barfly"); @@ -117,7 +116,7 @@ void testTruncateThroughSpi() { assertThat(resultCmd.length()).isEqualTo(255); assertThat(resultCmd.endsWith("...")).isTrue(); var cmdArgs = result.getAttribute(PROCESS_COMMAND_ARGS); - String joinedArgs = StringUtils.joinWith(", ", cmdArgs.toArray()); + String joinedArgs = String.join(", ", cmdArgs.toArray(new String[] {})); assertThat(joinedArgs.length()).isLessThan(255); assertThat(joinedArgs.endsWith("...")).isTrue(); assertThat(result.getAttribute(stringKey("foo"))).isEqualTo("barfly");