-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathRxJava2JdbcKotlinTest.kt
42 lines (37 loc) · 1 KB
/
RxJava2JdbcKotlinTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package rx.jdbc.kotlin
import kotlin.test.assertEquals
import org.junit.Test
import org.davidmoten.rx.jdbc.Database
import org.davidmoten.rx.jdbc.annotations.Query
import org.davidmoten.rx.jdbc.annotations.Column
import java.util.concurrent.TimeUnit
class RxJava2JdbcTest {
@Test
fun testSelect() : Unit {
Database
.test()
.select("select name from person order by name")
.getAs(String::class.java)
.test()
.awaitDone(20, TimeUnit.SECONDS)
.assertValues("FRED", "JOSEPH", "MARMADUKE")
.assertComplete()
}
@Test
fun testAutomap() : Unit {
Database
.test()
.select(Person::class.java)
.get()
.map({x -> x.nm()})
.test()
.awaitDone(20, TimeUnit.SECONDS)
.assertValues("FRED", "JOSEPH", "MARMADUKE")
.assertComplete()
}
}
@Query("select name from person order by name")
interface Person {
@Column("name")
fun nm() : String
}