dependencies {
    testImplementation testLibs.junit.jupiter.api
    testImplementation testLibs.hamcrest
    testRuntimeOnly testLibs.junit.jupiter.engine
}

test {
    useJUnitPlatform()
    doFirst {
        jvmArgs = [
                '--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED',
                '--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED',
                '--add-opens=java.base/java.nio=ALL-UNNAMED'
        ]
    }
    failFast = true
    testLogging {
        events 'STARTED', 'PASSED', 'FAILED', 'SKIPPED'
    }
    afterSuite { desc, result ->
        if (!desc.parent) {
            println "\nTest result: ${result.resultType}"
            println "Test summary: ${result.testCount} tests, " +
                    "${result.successfulTestCount} succeeded, " +
                    "${result.failedTestCount} failed, " +
                    "${result.skippedTestCount} skipped"
        }
    }
}