Skip to content

Commit 648a3c3

Browse files
author
Hanseter
committed
Update to java21 and kotlin 2
1 parent 3635357 commit 648a3c3

5 files changed

Lines changed: 23 additions & 4 deletions

File tree

.sdkmanrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Enable auto-env through the sdkman_auto_env config
2+
# Add key=value pairs of SDKs to use below
3+
java=21.0.4-tem

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<kotlin.compiler.jvmTarget>21</kotlin.compiler.jvmTarget>
1818
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1919
<kotlin.version>2.0.10</kotlin.version>
20-
<javafx.version>21.0.2</javafx.version>
20+
<javafx.version>21.0.4</javafx.version>
2121
<slf4j.version>1.7.32</slf4j.version>
2222
</properties>
2323

src/test/kotlin/com/github/hanseter/json/editor/AllOfTest.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ class AllOfTest {
6060
}]}}}""")
6161

6262
val data = JSONObject()
63-
editor.display("foo", "foo", data, schema) { it }
63+
WaitForAsyncUtils.asyncFx {
64+
editor.display("foo", "foo", data, schema) { it }
65+
}
66+
WaitForAsyncUtils.waitForFxEvents()
6467
val objectEntry = editor.getItemTable().root.children.first().findChildWithKey("notRoot")!!
6568
assertThat(objectEntry.children.size, `is`(0))
6669
(objectEntry.value.createControl()?.control as TypeWithChildrenStatusControl).button.fire()

src/test/kotlin/com/github/hanseter/json/editor/NumberTest.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.github.hanseter.json.editor
22

3+
import com.github.hanseter.json.editor.base.TestUtils.waitForAsyncFx
34
import com.github.hanseter.json.editor.util.ViewOptions
45
import javafx.scene.control.Spinner
56
import javafx.stage.Stage
@@ -35,7 +36,9 @@ class NumberTest {
3536
@Test
3637
fun displayExistingValue() {
3738
val schema = JSONObject("""{"type":"object","properties":{"num":{"type":"number"}}}""")
38-
editor.display("1", "1", JSONObject().put("num", 723.168), schema) { it }
39+
waitForAsyncFx {
40+
editor.display("1", "1", JSONObject().put("num", 723.168), schema) { it }
41+
}
3942
val itemTable = editor.getItemTable()
4043
val numberControl = editor.getControlInTable("num") as Spinner<Number>
4144
val converted = numberControl.valueFactory.converter.toString(723.168)
@@ -118,7 +121,9 @@ class NumberTest {
118121
fun displaysCorrectDefaultValue() {
119122
val schema =
120123
JSONObject("""{"type":"object","properties":{"num":{"type":"number","default":723.168}}}""")
121-
editor.display("1", "1", JSONObject(), schema) { it }
124+
waitForAsyncFx {
125+
editor.display("1", "1", JSONObject(), schema) { it }
126+
}
122127
val itemTable = editor.getItemTable()
123128
val numberControl = editor.getControlInTable("num") as Spinner<Number>
124129
val converted = numberControl.valueFactory.converter.toString(723.168)

src/test/kotlin/com/github/hanseter/json/editor/base/TestUtils.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.github.hanseter.json.editor.base
33
import org.controlsfx.control.SearchableComboBox
44
import org.json.JSONObject
55
import org.json.JSONTokener
6+
import org.testfx.util.WaitForAsyncUtils
67
import java.nio.file.Files
78
import java.nio.file.Paths
89
import java.util.stream.Collectors
@@ -22,4 +23,11 @@ object TestUtils {
2223
fun createSchemaComboBox() = SearchableComboBox<String>().apply {
2324
items.addAll(getAllSchemas())
2425
}
26+
27+
fun <T> waitForAsyncFx(callback: () -> T): T? {
28+
var ret: T? = null
29+
WaitForAsyncUtils.asyncFx { ret = callback() }
30+
WaitForAsyncUtils.waitForFxEvents()
31+
return ret
32+
}
2533
}

0 commit comments

Comments
 (0)