update build scripts
All checks were successful
continuous-integration/drone/push Build is passing

- upgrade to gradle 5.3.1
- upgrade to junit 5
- update test for compatibility to junit 5
This commit is contained in:
Raffaele Mignone 2019-04-14 11:39:11 +02:00
parent 079723937d
commit bb45e3ed9e
Signed by: norangebit
GPG Key ID: F5255658CB220573
14 changed files with 48 additions and 45 deletions

View File

@ -2,6 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
kotlin("jvm") version Config.Versions.kotlin kotlin("jvm") version Config.Versions.kotlin
jacoco
} }
group = "norangebit" group = "norangebit"
@ -21,8 +22,10 @@ dependencies {
testImplementation(Config.Libs.junit) testImplementation(Config.Libs.junit)
testImplementation(Config.Libs.kluent) testImplementation(Config.Libs.kluent)
testImplementation(Config.Libs.mockk) testImplementation(Config.Libs.mockk)
testImplementation (Config.Libs.jetbrainJunit)
// testImplementation(Config.Libs.spekDsl) // testImplementation(Config.Libs.spekDsl)
testRuntimeOnly(Config.Libs.junitEngine)
// testRuntimeOnly(Config.Libs.kotlinReflect) // testRuntimeOnly(Config.Libs.kotlinReflect)
// testRuntimeOnly(Config.Libs.spekRunner) // testRuntimeOnly(Config.Libs.spekRunner)
} }
@ -31,4 +34,8 @@ tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8" kotlinOptions.jvmTarget = "1.8"
} }
tasks.register("ktlint", Ktlint::class) tasks.getByName<Test>("test") {
useJUnitPlatform()
}
tasks.register("ktlint", Ktlint::class)

View File

@ -28,10 +28,10 @@ object Config {
val arrow = "0.8.2" val arrow = "0.8.2"
val kluent = "1.48" val kluent = "1.48"
val koin = "1.0.2" val koin = "1.0.2"
val junit = "5.1.0" val junit = "5.4.2"
val spek = "2.0.1" val spek = "2.0.1"
val kotlin = "1.3.21" val kotlin = "1.3.30"
val mockk = "1.9.2" val mockk = "1.9.3"
val gson = "2.8.5" val gson = "2.8.5"
} }
@ -39,11 +39,13 @@ object Config {
val arrowCore = "io.arrow-kt:arrow-core:${Versions.arrow}" val arrowCore = "io.arrow-kt:arrow-core:${Versions.arrow}"
val koin = "org.koin:koin-core:${Versions.koin}" val koin = "org.koin:koin-core:${Versions.koin}"
val junit = "org.junit.jupiter:junit-jupiter-api:${Versions.junit}" val junit = "org.junit.jupiter:junit-jupiter-api:${Versions.junit}"
val junitEngine = "org.junit.jupiter:junit-jupiter-engine:${Versions.junit}"
val kluent = "org.amshove.kluent:kluent:${Versions.kluent}" val kluent = "org.amshove.kluent:kluent:${Versions.kluent}"
val spekDsl = "org.spekframework.spek2:spek-dsl-jvm:${Versions.spek}" val spekDsl = "org.spekframework.spek2:spek-dsl-jvm:${Versions.spek}"
val kotlinReflect = "org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}" val kotlinReflect = "org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}"
val spekRunner = "org.spekframework.spek2:spek-runner-junit5:${Versions.spek}" val spekRunner = "org.spekframework.spek2:spek-runner-junit5:${Versions.spek}"
val mockk = "io.mockk:mockk:${Versions.mockk}" val mockk = "io.mockk:mockk:${Versions.mockk}"
val gson = "com.google.code.gson:gson:${Versions.gson}" val gson = "com.google.code.gson:gson:${Versions.gson}"
val jetbrainJunit = "org.jetbrains.kotlin:kotlin-test-junit:${Versions.kotlin}"
} }
} }

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -26,14 +26,14 @@
package it.norangeb.algorithms.datastructures.bag package it.norangeb.algorithms.datastructures.bag
import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should be equal to`
import org.junit.Before import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
class LinkedListBagTest { class LinkedListBagTest {
private var bag = LinkedListBag<Int>() private lateinit var bag :LinkedListBag<Int>
@Before @BeforeEach
fun makeBag() { fun init() {
bag = LinkedListBag() bag = LinkedListBag()
} }

View File

@ -26,13 +26,13 @@
package it.norangeb.algorithms.datastructures.bag package it.norangeb.algorithms.datastructures.bag
import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should be equal to`
import org.junit.Before import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
class ResizingArrayBagTest { class ResizingArrayBagTest {
private var bag = ResizingArrayBag<Int>() private lateinit var bag :ResizingArrayBag<Int>
@Before @BeforeEach
fun makeBag() { fun makeBag() {
bag = ResizingArrayBag() bag = ResizingArrayBag()
} }

View File

@ -30,13 +30,13 @@ import arrow.core.Some
import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should be equal to`
import org.amshove.kluent.`should be` import org.amshove.kluent.`should be`
import org.amshove.kluent.should import org.amshove.kluent.should
import org.junit.Before import org.junit.jupiter.api.BeforeEach
import org.junit.Test import org.junit.jupiter.api.Test
class MapTest { class MapTest {
lateinit var map: Dictionary<String, Int> lateinit var map: Dictionary<String, Int>
@Before @BeforeEach
fun init() { fun init() {
map = Map() map = Map()
} }

View File

@ -29,13 +29,13 @@ import arrow.core.None
import arrow.core.Some import arrow.core.Some
import arrow.core.getOrElse import arrow.core.getOrElse
import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should be equal to`
import org.junit.Before import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
class LinkedListQueueTest { class LinkedListQueueTest {
private var queue = LinkedListQueue<Int>() private lateinit var queue : LinkedListQueue<Int>
@Before @BeforeEach
fun makeQueue() { fun makeQueue() {
queue = LinkedListQueue() queue = LinkedListQueue()
} }

View File

@ -29,13 +29,13 @@ import arrow.core.None
import arrow.core.Some import arrow.core.Some
import arrow.core.getOrElse import arrow.core.getOrElse
import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should be equal to`
import org.junit.Before import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
class ResizingArrayQueueTest { class ResizingArrayQueueTest {
private var queue = ResizingArrayQueue<Int>() private lateinit var queue : ResizingArrayQueue<Int>
@Before @BeforeEach
fun makeQueue() { fun makeQueue() {
queue = ResizingArrayQueue() queue = ResizingArrayQueue()
} }

View File

@ -28,14 +28,14 @@ package it.norangeb.algorithms.datastructures.stack
import arrow.core.None import arrow.core.None
import arrow.core.getOrElse import arrow.core.getOrElse
import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should be equal to`
import org.junit.Before import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
class LinkedListStackTest { class LinkedListStackTest {
private var stack = LinkedListStack<Int>() private lateinit var stack : LinkedListStack<Int>
@Before @BeforeEach
fun makeStack() { fun init() {
stack = LinkedListStack() stack = LinkedListStack()
} }

View File

@ -26,13 +26,13 @@
package it.norangeb.algorithms.datastructures.unionfind package it.norangeb.algorithms.datastructures.unionfind
import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should be equal to`
import org.junit.Before import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
class QuickFindTest { class QuickFindTest {
private var unionFind = QuickFind(10) private lateinit var unionFind : QuickFind
@Before @BeforeEach
fun init() { fun init() {
unionFind = QuickFind(10) unionFind = QuickFind(10)
} }

View File

@ -26,13 +26,13 @@
package it.norangeb.algorithms.datastructures.unionfind package it.norangeb.algorithms.datastructures.unionfind
import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should be equal to`
import org.junit.Before import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
class QuickUnionCompressionPathTest { class QuickUnionCompressionPathTest {
private var unionFind = QuickUnion(10) private lateinit var unionFind : QuickUnion
@Before @BeforeEach
fun init() { fun init() {
unionFind = QuickUnion(10) unionFind = QuickUnion(10)
} }

View File

@ -26,13 +26,13 @@
package it.norangeb.algorithms.datastructures.unionfind package it.norangeb.algorithms.datastructures.unionfind
import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should be equal to`
import org.junit.Before import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
class QuickUnionTest { class QuickUnionTest {
private var unionFind = QuickUnion(10) private lateinit var unionFind : QuickUnion
@Before @BeforeEach
fun init() { fun init() {
unionFind = QuickUnion(10) unionFind = QuickUnion(10)
} }

View File

@ -26,13 +26,13 @@
package it.norangeb.algorithms.datastructures.unionfind package it.norangeb.algorithms.datastructures.unionfind
import org.amshove.kluent.`should be equal to` import org.amshove.kluent.`should be equal to`
import org.junit.Before import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
class QuickUnionWithSizeTest { class QuickUnionWithSizeTest {
private var unionFind = QuickUnionWithSize(10) private lateinit var unionFind : QuickUnionWithSize
@Before @BeforeEach
fun init() { fun init() {
unionFind = QuickUnionWithSize(10) unionFind = QuickUnionWithSize(10)
} }

View File

@ -26,22 +26,16 @@
package it.norangeb.algorithms.exercises package it.norangeb.algorithms.exercises
import org.amshove.kluent.`should equal` import org.amshove.kluent.`should equal`
import org.junit.Before import org.junit.jupiter.api.Test
import org.junit.Test
class OrderedListSorterTest { class OrderedListSorterTest {
lateinit var lists: List<List<Int>> val lists = listOf(
@Before
fun init() {
lists = listOf(
listOf(1, 5, 9, 10, 12, 14, 15, 15, 20, 25, 29, 31, 35, 37, 43, 48), listOf(1, 5, 9, 10, 12, 14, 15, 15, 20, 25, 29, 31, 35, 37, 43, 48),
listOf(2, 7, 12, 21, 23, 33, 35, 43, 45), listOf(2, 7, 12, 21, 23, 33, 35, 43, 45),
listOf(3, 7, 9, 12, 14, 16, 27, 28, 37, 39, 45, 45, 46, 50), listOf(3, 7, 9, 12, 14, 16, 27, 28, 37, 39, 45, 45, 46, 50),
listOf(1, 8, 9, 11, 13, 21, 25, 33, 34, 41, 47, 48) listOf(1, 8, 9, 11, 13, 21, 25, 33, 34, 41, 47, 48)
) )
}
@Test @Test
fun testSortUnsignedInt() { fun testSortUnsignedInt() {