diff --git a/sdk/src/test/kotlin/com/pulumi/kotlin/OutputTest.kt b/sdk/src/test/kotlin/com/pulumi/kotlin/OutputTest.kt index 7f6211c5..192351ae 100644 --- a/sdk/src/test/kotlin/com/pulumi/kotlin/OutputTest.kt +++ b/sdk/src/test/kotlin/com/pulumi/kotlin/OutputTest.kt @@ -9,7 +9,6 @@ import org.junit.jupiter.api.Test import java.util.concurrent.CompletableFuture import kotlin.test.assertEquals import kotlin.test.assertFalse -import kotlin.test.assertNotEquals import kotlin.test.assertTrue class OutputTest { @@ -43,8 +42,8 @@ class OutputTest { fun `interpolates unknown outputs`() { // given val output1 = Output.of("value1") - val output2 = Output.of("value2") - val output3 = OutputInternal(CompletableFuture.completedFuture(OutputData.unknown())) + val output2 = unknownOutput() + val output3 = Output.of("value3") // when val result = runBlocking { @@ -68,8 +67,8 @@ class OutputTest { fun `interpolates secret outputs`() { // given val output1 = Output.of("value1") - val output2 = Output.of("value2") - val output3 = Output.ofSecret("value3") + val output2 = Output.ofSecret("value2") + val output3 = Output.of("value3") // when val result = runBlocking { @@ -92,9 +91,9 @@ class OutputTest { @Test fun `interpolates unknown and secret outputs`() { // given - val output1 = OutputInternal(CompletableFuture.completedFuture(OutputData.unknown())) + val output1 = unknownOutput() val output2 = Output.ofSecret("value2") - val output3 = OutputInternal(CompletableFuture.completedFuture(OutputData.unknown())) + val output3 = unknownOutput() // when val result = runBlocking { @@ -118,9 +117,8 @@ class OutputTest { fun `interpolates outputs that are both unknown and secret`() { // given val output1 = Output.of("value1") - val output2 = Output.ofSecret("value2") - val output3 = - (OutputInternal(CompletableFuture.completedFuture(OutputData.unknown())) as Output).asSecret() + val output2 = unknownOutput().asSecret() + val output3 = Output.of("value3") // when val result = runBlocking { @@ -140,6 +138,10 @@ class OutputTest { assertEquals(javaResult.isSecret(), result.isSecret()) } + private fun unknownOutput(): Output { + return OutputInternal(CompletableFuture.completedFuture(OutputData.unknown())) + } + private fun Output.getValue(): String? { return (this as OutputInternal) .dataAsync @@ -158,4 +160,4 @@ class OutputTest { .isSecret .get() } -} \ No newline at end of file +}