diff --git a/kotlin/build.gradle b/kotlin/build.gradle index eb9cb70..57e2ec7 100644 --- a/kotlin/build.gradle +++ b/kotlin/build.gradle @@ -17,6 +17,7 @@ dependencies { testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1' testCompile("org.junit.jupiter:junit-jupiter-params:5.4.2") + testCompile 'com.approvaltests:approvaltests:3.2.0' } test { diff --git a/kotlin/gradle/wrapper/gradle-wrapper.properties b/kotlin/gradle/wrapper/gradle-wrapper.properties index 290541c..35ddd86 100644 --- a/kotlin/gradle/wrapper/gradle-wrapper.properties +++ b/kotlin/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Tue Sep 10 10:36:28 CEST 2019 +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/kotlin/src/test/kotlin/StatementPrinterTests.exampleStatement$kotlin.approved.txt b/kotlin/src/test/kotlin/StatementPrinterTests.exampleStatement$kotlin.approved.txt new file mode 100644 index 0000000..fa59f94 --- /dev/null +++ b/kotlin/src/test/kotlin/StatementPrinterTests.exampleStatement$kotlin.approved.txt @@ -0,0 +1,6 @@ +Statement for BigCo + Hamlet: $650.00 (55 seats) + As You Like It: $580.00 (35 seats) + Othello: $500.00 (40 seats) +Amount owed is $1,730.00 +You earned 47 credits diff --git a/kotlin/src/test/kotlin/StatementPrinterTests.kt b/kotlin/src/test/kotlin/StatementPrinterTests.kt index d54adab..cba9aa4 100644 --- a/kotlin/src/test/kotlin/StatementPrinterTests.kt +++ b/kotlin/src/test/kotlin/StatementPrinterTests.kt @@ -1,17 +1,12 @@ -import org.junit.jupiter.api.Assertions.assertEquals + import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test +import org.approvaltests.Approvals.verify class StatementPrinterTests { @Test internal fun exampleStatement() { - val expected = "Statement for BigCo\n" + - " Hamlet: \$650.00 (55 seats)\n" + - " As You Like It: \$580.00 (35 seats)\n" + - " Othello: \$500.00 (40 seats)\n" + - "Amount owed is \$1,730.00\n" + - "You earned 47 credits\n" val plays = mapOf( "hamlet" to Play("Hamlet", "tragedy"), @@ -30,7 +25,7 @@ class StatementPrinterTests { val statementPrinter = StatementPrinter() val result = statementPrinter.print(invoice, plays) - assertEquals(expected, result) + verify(result) } @Test