Skip to content

Commit 5c59a51

Browse files
authored
Migrate to AssertK (#706)
1 parent fd90ba0 commit 5c59a51

File tree

4 files changed

+29
-22
lines changed

4 files changed

+29
-22
lines changed

core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies {
2222
testFixturesCompileOnly libs.bundles.intelliJ
2323

2424
testImplementation libs.junit
25-
testImplementation libs.truth
25+
testImplementation libs.assertk
2626
testImplementation(libs.bundles.intelliJ) {
2727
exclude(group: "org.jetbrains.kotlinx", module: "kotlinx-coroutines-core")
2828
}

core/src/test/kotlin/com/alecstrong/sql/psi/core/NullabilityTest.kt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package com.alecstrong.sql.psi.core
22

3+
import assertk.assertThat
4+
import assertk.assertions.isFalse
5+
import assertk.assertions.isNotNull
6+
import assertk.assertions.isNull
7+
import assertk.assertions.isTrue
38
import com.alecstrong.sql.psi.test.fixtures.compileFile
4-
import com.google.common.truth.Truth.assertThat
59
import org.junit.Test
610

711
class NullabilityTest {
@@ -33,8 +37,8 @@ class NullabilityTest {
3337
val projection = select.queryExposed().flatMap { it.columns }
3438

3539
assertThat(projection[0].nullable).isNull()
36-
assertThat(projection[1].nullable).isTrue()
37-
assertThat(projection[2].nullable).isTrue()
40+
assertThat(projection[1].nullable).isNotNull().isTrue()
41+
assertThat(projection[2].nullable).isNotNull().isTrue()
3842
}
3943
}
4044

@@ -77,7 +81,7 @@ class NullabilityTest {
7781

7882
assertThat(projection[0].nullable).isNull()
7983
assertThat(projection[1].nullable).isNull()
80-
assertThat(projection[2].nullable).isTrue()
84+
assertThat(projection[2].nullable).isNotNull().isTrue()
8185
}
8286
}
8387

@@ -99,9 +103,9 @@ class NullabilityTest {
99103
val select = file.sqlStmtList!!.stmtList.mapNotNull { it.compoundSelectStmt }.single()
100104
val projection = select.queryExposed().flatMap { it.columns }
101105

102-
assertThat(projection[0].nullable).isFalse()
103-
assertThat(projection[1].nullable).isFalse()
104-
assertThat(projection[2].nullable).isFalse()
106+
assertThat(projection[0].nullable).isNotNull().isFalse()
107+
assertThat(projection[1].nullable).isNotNull().isFalse()
108+
assertThat(projection[2].nullable).isNotNull().isFalse()
105109
}
106110
}
107111
}

core/src/test/kotlin/com/alecstrong/sql/psi/core/TablesExposedTest.kt

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package com.alecstrong.sql.psi.core
22

3+
import assertk.assertThat
4+
import assertk.assertions.containsExactlyInAnyOrder
35
import com.alecstrong.sql.psi.test.fixtures.compileFiles
4-
import com.google.common.truth.Truth.assertThat
56
import org.junit.Test
67

78
class TablesExposedTest {
@@ -38,13 +39,14 @@ class TablesExposedTest {
3839
),
3940
) { (_, file) ->
4041

41-
assertThat(file.tables(includeAll = true).map { it.tableName.text }).containsExactly(
42-
"predefined",
43-
"test1",
44-
"test2",
45-
"test4",
46-
"test5",
47-
)
42+
assertThat(file.tables(includeAll = true).map { it.tableName.text })
43+
.containsExactlyInAnyOrder(
44+
"predefined",
45+
"test1",
46+
"test2",
47+
"test4",
48+
"test5",
49+
)
4850
}
4951
}
5052

@@ -81,11 +83,12 @@ class TablesExposedTest {
8183
),
8284
) { (_, file) ->
8385

84-
assertThat(file.tables(includeAll = false).map { it.tableName.text }).containsExactly(
85-
"test2",
86-
"test4",
87-
"test5",
88-
)
86+
assertThat(file.tables(includeAll = false).map { it.tableName.text })
87+
.containsExactlyInAnyOrder(
88+
"test2",
89+
"test4",
90+
"test5",
91+
)
8992
}
9093
}
9194
}

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ intellijUtilUi = { module = "com.jetbrains.intellij.platform:util-ui", version.r
1515
coroutines-core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2"
1616

1717
junit = "junit:junit:4.13.2"
18-
truth = "com.google.truth:truth:1.4.4"
18+
assertk = "com.willowtreeapps.assertk:assertk:0.28.1"
1919

2020
[bundles]
2121
intelliJ = ["intellijCoreImpl", "intellijProjectModelImpl", "intellijAnalysisImpl", "intellijIndexing", "intellijUtilUi"]

0 commit comments

Comments
 (0)