Skip to content

Commit

Permalink
misc: override toString in business metrics (#1188)
Browse files Browse the repository at this point in the history
  • Loading branch information
0marperez authored Dec 2, 2024
1 parent 9f24ab4 commit 2895ea2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions runtime/runtime-core/api/runtime-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public final class aws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetri
public static final field WAITER Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public fun getIdentifier ()Ljava/lang/String;
public fun toString ()Ljava/lang/String;
public static fun valueOf (Ljava/lang/String;)Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric;
public static fun values ()[Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,7 @@ public enum class SmithyBusinessMetric(public override val identifier: String) :
SERVICE_ENDPOINT_OVERRIDE("N"),
ACCOUNT_ID_BASED_ENDPOINT("O"),
SIGV4A_SIGNING("S"),
;

override fun toString(): String = identifier
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package aws.smithy.kotlin.runtime.businessmetrics
import aws.smithy.kotlin.runtime.collections.get
import aws.smithy.kotlin.runtime.operation.ExecutionContext
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue

Expand Down Expand Up @@ -55,4 +56,12 @@ class BusinessMetricsUtilsTest {
executionContext.removeBusinessMetric(SmithyBusinessMetric.GZIP_REQUEST_COMPRESSION)
assertFalse(executionContext.containsBusinessMetric(SmithyBusinessMetric.GZIP_REQUEST_COMPRESSION))
}

@Test
fun businessMetricToString() {
val businessMetricToString = SmithyBusinessMetric.GZIP_REQUEST_COMPRESSION.toString()
val businessMetricIdentifier = SmithyBusinessMetric.GZIP_REQUEST_COMPRESSION.identifier

assertEquals(businessMetricIdentifier, businessMetricToString)
}
}

0 comments on commit 2895ea2

Please sign in to comment.