Skip to content

Commit 7a6749e

Browse files
committed
Error Prone / NullAway support for JSpecify - added Kotlin - tweak to assert
1 parent 4a68a39 commit 7a6749e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/test/kotlin/org/dataloader/KotlinExamples.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package org.dataloader
22

33
import org.junit.jupiter.api.Test
44
import java.util.concurrent.CompletableFuture
5+
import java.util.concurrent.CompletableFuture.*
56

67
/**
78
* Some Kotlin code to prove that are JSpecify annotations work here
@@ -12,28 +13,28 @@ class KotlinExamples {
1213

1314
@Test
1415
fun `basic kotlin test of non nullable value types`() {
15-
val dataLoader: DataLoader<String, String> = DataLoaderFactory.newDataLoader { keys -> CompletableFuture.completedFuture(keys.toList()) }
16+
val dataLoader: DataLoader<String, String> = DataLoaderFactory.newDataLoader { keys -> completedFuture(keys.toList()) }
1617

1718
val cfA = dataLoader.load("A")
1819
val cfB = dataLoader.load("B")
1920

2021
dataLoader.dispatch()
2122

22-
cfA.join().equals("A")
23-
cfB.join().equals("B")
23+
assert(cfA.join().equals("A"))
24+
assert(cfA.join().equals("A"))
2425
}
2526

2627
@Test
2728
fun `basic kotlin test of nullable value types`() {
28-
val dataLoader: DataLoader<String, String?> = DataLoaderFactory.newDataLoader { keys -> CompletableFuture.completedFuture(keys.toList()) }
29+
val dataLoader: DataLoader<String, String?> = DataLoaderFactory.newDataLoader { keys -> completedFuture(keys.toList()) }
2930

3031
val cfA = dataLoader.load("A")
3132
val cfB = dataLoader.load("B")
3233

3334
dataLoader.dispatch()
3435

35-
cfA.join().equals("A")
36-
cfB.join().equals("B")
36+
assert(cfA.join().equals("A"))
37+
assert(cfA.join().equals("A"))
3738
}
3839

3940
}

0 commit comments

Comments
 (0)