Skip to content

Commit ad5c4bc

Browse files
committed
Migrate tests from DynaTest to JUnit5
1 parent 9d55a57 commit ad5c4bc

File tree

7 files changed

+8
-543
lines changed

7 files changed

+8
-543
lines changed

build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ dependencies {
3131
testImplementation(libs.bundles.hibernate.validator)
3232

3333
// tests
34-
testImplementation(libs.dynatest)
3534
testImplementation(kotlin("test"))
3635
testImplementation(libs.junit.jupiter.engine)
3736
testImplementation(libs.bundles.gson)

src/test/kotlin/com/github/vokorm/AbstractDbDaoTests.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package com.github.vokorm
22

3-
import com.github.mvysny.dynatest.DynaNodeGroup
4-
import com.github.mvysny.dynatest.DynaTestDsl
5-
import com.github.mvysny.dynatest.expectThrows
63
import org.junit.jupiter.api.Nested
74
import org.junit.jupiter.api.Test
85
import java.time.Instant
@@ -105,14 +102,14 @@ abstract class AbstractDbDaoTests {
105102

106103
@Test fun `fails if there are two matching entities`() {
107104
repeat(2) { Person(name = "Albedo", age = 131).save() }
108-
expectThrows(IllegalStateException::class, "too many rows matching Person: '(Test.name) = ") {
105+
expectThrows<IllegalStateException>("too many rows matching Person: '(Test.name) = ") {
109106
Person.findSingleBy { Person::name eq "Albedo" }
110107
}
111108
}
112109

113110
@Test fun `fails if there are ten matching entities`() {
114111
repeat(10) { Person(name = "Albedo", age = 132).save() }
115-
expectThrows(IllegalStateException::class, "too many rows matching Person: '(Test.name) = ") {
112+
expectThrows<IllegalStateException>("too many rows matching Person: '(Test.name) = ") {
116113
Person.findSingleBy { Person::name eq "Albedo" }
117114
}
118115
}

src/test/kotlin/com/github/vokorm/AbstractDbMappingTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
package com.github.vokorm
44

5-
import com.github.mvysny.dynatest.*
65
import org.jdbi.v3.core.mapper.reflect.FieldMapper
76
import org.junit.jupiter.api.Nested
87
import org.junit.jupiter.api.Test
@@ -59,7 +58,7 @@ abstract class AbstractDbMappingTests() {
5958
}
6059
@Test fun `updating non-existing row fails`() {
6160
val p = Person(id = 15, name = "Zaphod", age = 20, created = Date(1000), modified = Instant.ofEpochMilli(120398123))
62-
expectThrows(IllegalStateException::class, "We expected to update only one row but we updated 0 - perhaps there is no row with id 15?") {
61+
expectThrows<IllegalStateException>("We expected to update only one row but we updated 0 - perhaps there is no row with id 15?") {
6362
p.save()
6463
}
6564
}

src/test/kotlin/com/github/vokorm/ConditionBuilderTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
package com.github.vokorm
22

3-
import com.github.mvysny.dynatest.DynaTest
3+
import org.junit.jupiter.api.Test
44
import kotlin.test.expect
55

6-
class ConditionBuilderTest : DynaTest({
7-
test("smoke API tests") {
6+
class ConditionBuilderTest {
7+
@Test fun `smoke API tests`() {
88
buildCondition { Person::name eq "foo" }
99
buildCondition { !(Person::name eq "foo") }
1010
buildCondition { (Person::name eq "foo") and (Person::id gt 25)}
1111
buildCondition { (Person::name eq "foo") or (Person::id gt 25)}
1212
}
13-
test("produced condition") {
13+
@Test fun `produced condition`() {
1414
expect("Person.name = foo") {
1515
buildCondition { Person::name eq "foo" } .toString()
1616
}
@@ -24,4 +24,4 @@ class ConditionBuilderTest : DynaTest({
2424
buildCondition { (Person::name eq "foo") or (Person::id gt 25)} .toString()
2525
}
2626
}
27-
})
27+
}

src/test/kotlin/com/github/vokorm/DaoTest.kt

Lines changed: 0 additions & 233 deletions
This file was deleted.

0 commit comments

Comments
 (0)