From 78e8fbdead4ed01fea29caec73b60e5361818a15 Mon Sep 17 00:00:00 2001 From: Julia Plewa Date: Sat, 23 Sep 2023 16:39:00 +0200 Subject: [PATCH] update OutputTest Signed-off-by: Julia Plewa --- .../kotlin/com/pulumi/kotlin/OutputTest.kt | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/sdk/src/test/kotlin/com/pulumi/kotlin/OutputTest.kt b/sdk/src/test/kotlin/com/pulumi/kotlin/OutputTest.kt index 7f6211c5a..57ebc3392 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