@@ -9,7 +9,6 @@ import org.junit.jupiter.api.Test
99import java.util.concurrent.CompletableFuture
1010import kotlin.test.assertEquals
1111import kotlin.test.assertFalse
12- import kotlin.test.assertNotEquals
1312import kotlin.test.assertTrue
1413
1514class OutputTest {
@@ -43,8 +42,8 @@ class OutputTest {
4342 fun `interpolates unknown outputs` () {
4443 // given
4544 val output1 = Output .of(" value1" )
46- val output2 = Output .of( " value2 " )
47- val output3 = OutputInternal ( CompletableFuture .completedFuture( OutputData .unknown< String >()) )
45+ val output2 = unknownOutput( )
46+ val output3 = Output .of( " value3 " )
4847
4948 // when
5049 val result = runBlocking {
@@ -68,8 +67,8 @@ class OutputTest {
6867 fun `interpolates secret outputs` () {
6968 // given
7069 val output1 = Output .of(" value1" )
71- val output2 = Output .of (" value2" )
72- val output3 = Output .ofSecret (" value3" )
70+ val output2 = Output .ofSecret (" value2" )
71+ val output3 = Output .of (" value3" )
7372
7473 // when
7574 val result = runBlocking {
@@ -92,9 +91,9 @@ class OutputTest {
9291 @Test
9392 fun `interpolates unknown and secret outputs` () {
9493 // given
95- val output1 = OutputInternal ( CompletableFuture .completedFuture( OutputData .unknown< String >()) )
94+ val output1 = unknownOutput( )
9695 val output2 = Output .ofSecret(" value2" )
97- val output3 = OutputInternal ( CompletableFuture .completedFuture( OutputData .unknown< String >()) )
96+ val output3 = unknownOutput( )
9897
9998 // when
10099 val result = runBlocking {
@@ -118,9 +117,8 @@ class OutputTest {
118117 fun `interpolates outputs that are both unknown and secret` () {
119118 // given
120119 val output1 = Output .of(" value1" )
121- val output2 = Output .ofSecret(" value2" )
122- val output3 =
123- (OutputInternal (CompletableFuture .completedFuture(OutputData .unknown<String >())) as Output <String >).asSecret()
120+ val output2 = unknownOutput().asSecret()
121+ val output3 = Output .of(" value3" )
124122
125123 // when
126124 val result = runBlocking {
@@ -140,6 +138,10 @@ class OutputTest {
140138 assertEquals(javaResult.isSecret(), result.isSecret())
141139 }
142140
141+ private fun unknownOutput (): Output <String > {
142+ return OutputInternal (CompletableFuture .completedFuture(OutputData .unknown()))
143+ }
144+
143145 private fun Output<String>.getValue (): String? {
144146 return (this as OutputInternal <String >)
145147 .dataAsync
@@ -158,4 +160,4 @@ class OutputTest {
158160 .isSecret
159161 .get()
160162 }
161- }
163+ }
0 commit comments