Skip to content

Commit

Permalink
upgraded to latest kotlintest
Browse files Browse the repository at this point in the history
  • Loading branch information
sunitparekh committed May 21, 2018
1 parent 4853b05 commit aa6b92d
Show file tree
Hide file tree
Showing 34 changed files with 101 additions and 91 deletions.
25 changes: 15 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.version>1.2.40</kotlin.version>
<kotlin.test.version>2.0.7</kotlin.test.version>
<kotlin.version>1.2.41</kotlin.version>
<version.jacoco>0.8.1</version.jacoco>
</properties>

Expand Down Expand Up @@ -94,16 +93,10 @@
<artifactId>progressbar</artifactId>
<version>0.6.0</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.kotlintest</groupId>
<artifactId>kotlintest</artifactId>
<version>${kotlin.test.version}</version>
<artifactId>kotlintest-runner-junit5</artifactId>
<version>3.1.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -129,6 +122,18 @@
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.2.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
Expand Down
5 changes: 3 additions & 2 deletions src/test/kotlin/com/github/dataanon/Matchers.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.github.dataanon

import io.kotlintest.matchers.Matcher
import io.kotlintest.matchers.Result
import io.kotlintest.Matcher
import io.kotlintest.Result


interface Matchers {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import com.github.dataanon.strategy.string.FixedString
import com.github.dataanon.support.MoviesTable
import com.github.dataanon.support.MoviesTableHavingGenreSize10
import com.github.dataanon.utils.DataAnonTestLogHandler
import io.kotlintest.matchers.*
import io.kotlintest.matchers.beLessThan
import io.kotlintest.matchers.haveSubstring
import io.kotlintest.matchers.match
import io.kotlintest.should
import io.kotlintest.shouldBe
import io.kotlintest.specs.FunSpec
import java.time.LocalDate
import java.util.logging.Level
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import com.github.dataanon.strategy.string.FixedString
import com.github.dataanon.strategy.string.RandomAlphabetic
import com.github.dataanon.support.MoviesTable
import io.kotlintest.matchers.match
import io.kotlintest.matchers.should
import io.kotlintest.matchers.shouldBe
import io.kotlintest.should
import io.kotlintest.shouldBe
import io.kotlintest.specs.FunSpec
import java.time.LocalDate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import com.github.dataanon.strategy.list.PickFromDatabase
import com.github.dataanon.strategy.string.FixedString
import com.github.dataanon.support.MoviesTable
import io.kotlintest.matchers.match
import io.kotlintest.matchers.should
import io.kotlintest.matchers.shouldBe
import io.kotlintest.should
import io.kotlintest.shouldBe
import io.kotlintest.specs.FunSpec
import java.time.LocalDate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import com.github.dataanon.strategy.string.FixedString
import com.github.dataanon.support.MoviesTable
import com.github.dataanon.support.RatingsTable
import io.kotlintest.matchers.match
import io.kotlintest.matchers.should
import io.kotlintest.matchers.shouldBe
import io.kotlintest.should
import io.kotlintest.shouldBe
import io.kotlintest.specs.FunSpec
import java.time.Duration
import java.time.LocalDate
Expand Down Expand Up @@ -50,13 +50,13 @@ class BlacklistMultipleTableIntegrationTest : FunSpec(), Matchers {
ratingRecords[0]["USER_ID"] shouldBe 1
ratingRecords[0]["RATING"] shouldBe 3
val timestamp1 = LocalDateTime.ofEpochSecond(1509701304, 0, ZoneOffset.UTC)
(ratingRecords[0]["CREATED_AT"] as LocalDateTime) should beIn(timestamp1.minusSeconds(250)..timestamp1.plusSeconds(250))
(ratingRecords[0]["CREATED_AT"] as LocalDateTime) should beIn(timestamp1.minusSeconds(300)..timestamp1.plusSeconds(300))

ratingRecords[1]["MOVIE_ID"] shouldBe 1
ratingRecords[1]["USER_ID"] shouldBe 2
ratingRecords[1]["RATING"] shouldBe 3
val timestamp2 = LocalDateTime.ofEpochSecond(1509701310, 0, ZoneOffset.UTC)
(ratingRecords[0]["CREATED_AT"] as LocalDateTime) should beIn(timestamp2.minusSeconds(250)..timestamp2.plusSeconds(250))
(ratingRecords[0]["CREATED_AT"] as LocalDateTime) should beIn(timestamp2.minusSeconds(300)..timestamp2.plusSeconds(300))

closeResources(moviesTable, ratingsTable)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.github.dataanon.dsl.Blacklist
import com.github.dataanon.model.DbConfig
import com.github.dataanon.strategy.number.FixedInt
import com.github.dataanon.support.RatingsTable
import io.kotlintest.matchers.shouldBe
import io.kotlintest.shouldBe
import io.kotlintest.specs.FunSpec
import java.time.LocalDateTime
import java.time.ZoneOffset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import com.github.dataanon.model.DbConfig
import com.github.dataanon.strategy.string.FixedString
import com.github.dataanon.support.MoviesTable
import io.kotlintest.matchers.match
import io.kotlintest.matchers.should
import io.kotlintest.matchers.shouldBe
import io.kotlintest.should
import io.kotlintest.shouldBe
import io.kotlintest.specs.FunSpec
import org.junit.jupiter.api.Assertions.assertEquals
import java.time.LocalDate
import kotlin.test.assertEquals

class WhitelistMoviesSimplePrimaryKeyIntegrationTest : FunSpec() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.github.dataanon.jdbc
import com.github.dataanon.model.BlacklistTable
import com.github.dataanon.model.DbConfig
import com.github.dataanon.support.MoviesTable
import io.kotlintest.matchers.shouldBe
import io.kotlintest.shouldBe
import io.kotlintest.specs.FunSpec
import java.time.LocalDate

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.dataanon.model

import io.kotlintest.matchers.shouldBe
import io.kotlintest.shouldBe
import io.kotlintest.specs.FunSpec

class BlacklistTableUnitTest : FunSpec() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.dataanon.model

import com.github.dataanon.strategy.AnonymizationStrategy
import io.kotlintest.matchers.shouldBe
import io.kotlintest.shouldBe
import io.kotlintest.specs.FunSpec

class WhitelistTableUnitTest : FunSpec() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.github.dataanon.strategy

import com.github.dataanon.model.Field
import com.github.dataanon.model.Record
import io.kotlintest.matchers.shouldEqual
import io.kotlintest.shouldBe
import io.kotlintest.specs.FunSpec

class CopyAnonymizationStrategyUnitTest : FunSpec() {
Expand All @@ -16,7 +16,7 @@ class CopyAnonymizationStrategyUnitTest : FunSpec() {
val copyAnonymizationStrategy = CopyAnonymizationStrategy<String>()
val anonymized = copyAnonymizationStrategy.anonymize(field, emptyRecord)

anonymized shouldEqual "John"
anonymized shouldBe "John"
}

test("should return Double value as is given CopyAnonymizationStrategy") {
Expand All @@ -25,7 +25,7 @@ class CopyAnonymizationStrategyUnitTest : FunSpec() {
val copyAnonymizationStrategy = CopyAnonymizationStrategy<Double>()
val anonymized = copyAnonymizationStrategy.anonymize(field, emptyRecord)

anonymized shouldEqual 12.56
anonymized shouldBe 12.56
}

test("should return Int value as is given CopyAnonymizationStrategy") {
Expand All @@ -34,7 +34,7 @@ class CopyAnonymizationStrategyUnitTest : FunSpec() {
val copyAnonymizationStrategy = CopyAnonymizationStrategy<Int>()
val anonymized = copyAnonymizationStrategy.anonymize(field, emptyRecord)

anonymized shouldEqual 12
anonymized shouldBe 12
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.github.dataanon.strategy.bool
import com.github.dataanon.Matchers
import com.github.dataanon.model.Field
import com.github.dataanon.model.Record
import io.kotlintest.matchers.should
import io.kotlintest.should
import io.kotlintest.specs.FunSpec

class RandomBooleanUnitTest : FunSpec(), Matchers {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package com.github.dataanon.strategy.datetime
import com.github.dataanon.Matchers
import com.github.dataanon.model.Field
import com.github.dataanon.model.Record
import io.kotlintest.matchers.should
import io.kotlintest.properties.forAll
import io.kotlintest.properties.headers
import io.kotlintest.properties.row
import io.kotlintest.properties.table
import io.kotlintest.should
import io.kotlintest.specs.FunSpec
import io.kotlintest.tables.forAll
import io.kotlintest.tables.headers
import io.kotlintest.tables.row
import io.kotlintest.tables.table
import java.time.LocalDate

class DateRandomDeltaTest : FunSpec(), Matchers {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package com.github.dataanon.strategy.datetime
import com.github.dataanon.Matchers
import com.github.dataanon.model.Field
import com.github.dataanon.model.Record
import io.kotlintest.matchers.should
import io.kotlintest.properties.forAll
import io.kotlintest.properties.headers
import io.kotlintest.properties.row
import io.kotlintest.properties.table
import io.kotlintest.should
import io.kotlintest.specs.FunSpec
import io.kotlintest.tables.forAll
import io.kotlintest.tables.headers
import io.kotlintest.tables.row
import io.kotlintest.tables.table
import java.time.Duration
import java.time.LocalDateTime
import java.time.ZoneOffset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package com.github.dataanon.strategy.email
import com.github.dataanon.Matchers
import com.github.dataanon.model.Field
import com.github.dataanon.model.Record
import io.kotlintest.matchers.should
import io.kotlintest.matchers.shouldThrow
import io.kotlintest.should
import io.kotlintest.shouldThrow
import io.kotlintest.specs.FunSpec

class RandomEmailUnitTest : FunSpec(), Matchers {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import com.github.dataanon.model.DbConfig
import com.github.dataanon.model.Field
import com.github.dataanon.model.Record
import com.github.dataanon.support.MoviesTable
import io.kotlintest.matchers.should
import io.kotlintest.matchers.shouldThrow
import io.kotlintest.should
import io.kotlintest.shouldThrow
import io.kotlintest.specs.FunSpec
import java.time.LocalDate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import com.github.dataanon.Matchers
import com.github.dataanon.model.Field
import com.github.dataanon.model.Record
import com.github.dataanon.strategy.string.PickStringFromFile
import io.kotlintest.matchers.should
import io.kotlintest.matchers.shouldThrow
import io.kotlintest.should
import io.kotlintest.shouldThrow
import io.kotlintest.specs.FunSpec
import java.io.File

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import com.github.dataanon.Matchers
import com.github.dataanon.model.Field
import com.github.dataanon.model.Record
import com.github.dataanon.strategy.list.PickFromList
import io.kotlintest.matchers.should
import io.kotlintest.matchers.shouldThrow
import io.kotlintest.should
import io.kotlintest.shouldThrow
import io.kotlintest.specs.FunSpec

class PickFromListUnitTest : FunSpec(), Matchers {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package com.github.dataanon.strategy.name
import com.github.dataanon.Matchers
import com.github.dataanon.model.Field
import com.github.dataanon.model.Record
import io.kotlintest.matchers.should
import io.kotlintest.matchers.shouldThrow
import io.kotlintest.should
import io.kotlintest.shouldThrow
import io.kotlintest.specs.FunSpec
import java.io.File

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package com.github.dataanon.strategy.name
import com.github.dataanon.Matchers
import com.github.dataanon.model.Field
import com.github.dataanon.model.Record
import io.kotlintest.matchers.should
import io.kotlintest.matchers.shouldEqual
import io.kotlintest.should
import io.kotlintest.shouldBe
import io.kotlintest.specs.FunSpec
import java.io.File

Expand Down Expand Up @@ -33,7 +33,7 @@ class RandomFullNameUnitTest : FunSpec(), Matchers {
val anonymized = randomFullName.anonymize(field, emptyRecord)
val nameComponents = anonymized.split(" ")

nameComponents.size shouldEqual 2
nameComponents.size shouldBe 2
}

test("should return random full name from provided sources") {
Expand All @@ -60,7 +60,7 @@ class RandomFullNameUnitTest : FunSpec(), Matchers {
val anonymized = randomFullName.anonymize(field, emptyRecord)
val nameComponents = anonymized.split(" ")

nameComponents.size shouldEqual 2
nameComponents.size shouldBe 2
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.github.dataanon.strategy.name
import com.github.dataanon.Matchers
import com.github.dataanon.model.Field
import com.github.dataanon.model.Record
import io.kotlintest.matchers.should
import io.kotlintest.should
import io.kotlintest.specs.FunSpec
import java.io.File

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.github.dataanon.strategy.number
import com.github.dataanon.Matchers
import com.github.dataanon.model.Field
import com.github.dataanon.model.Record
import io.kotlintest.matchers.should
import io.kotlintest.should
import io.kotlintest.specs.FunSpec

class RandomDoubleDeltaUnitTest : FunSpec(), Matchers{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.github.dataanon.strategy.number
import com.github.dataanon.Matchers
import com.github.dataanon.model.Field
import com.github.dataanon.model.Record
import io.kotlintest.matchers.should
import io.kotlintest.should
import io.kotlintest.specs.FunSpec

class RandomDoubleUnitTest : FunSpec(), Matchers {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.github.dataanon.strategy.number
import com.github.dataanon.Matchers
import com.github.dataanon.model.Field
import com.github.dataanon.model.Record
import io.kotlintest.matchers.should
import io.kotlintest.should
import io.kotlintest.specs.FunSpec

class RandomFloatDeltaUnitTest : FunSpec(), Matchers {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.github.dataanon.strategy.number
import com.github.dataanon.Matchers
import com.github.dataanon.model.Field
import com.github.dataanon.model.Record
import io.kotlintest.matchers.should
import io.kotlintest.should
import io.kotlintest.specs.FunSpec

class RandomFloatUnitTest : FunSpec(), Matchers {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.github.dataanon.strategy.number
import com.github.dataanon.Matchers
import com.github.dataanon.model.Field
import com.github.dataanon.model.Record
import io.kotlintest.matchers.should
import io.kotlintest.should
import io.kotlintest.specs.FunSpec

class RandomIntDeltaUnitTest : FunSpec(), Matchers {
Expand Down
Loading

0 comments on commit aa6b92d

Please sign in to comment.