Skip to content

Commit 37dab6b

Browse files
committed
Polish Kotlin tests
1 parent 8d788e4 commit 37dab6b

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

documentation/src/test/kotlin/example/AssertionsDemoKotlin.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class AssertionsDemoKotlin {
2020

2121
// end::user_guide[]
2222
val person = Person("John", "Doe")
23-
val people = setOf(person, Person("James", "Doe"))
23+
val people = setOf(person, Person("Jane", "Doe"))
2424

2525
// tag::user_guide[]
2626
@Test

junit-jupiter-engine/src/test/kotlin/org/junit/jupiter/api/AssertionsAssertAllKotlinTests.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,27 @@ class AssertionsAssertAllKotlinTests {
4848
}
4949

5050
@Test
51-
fun `assertAll with streamOf functions that throw AssertionErrors`() {
51+
fun `assertAll with stream of functions that throw AssertionErrors`() {
5252
val multipleFailuresError = assertThrows<MultipleFailuresError>("Should have thrown multiple errors") {
5353
assertAll(Stream.of({ assertFalse(true) }, { assertFalse(true) }))
5454
}
5555
assertExpectedExceptionTypes(multipleFailuresError, AssertionFailedError::class, AssertionFailedError::class)
5656
}
5757

5858
@Test
59-
fun `assertThrows that does not have exception thrown does not throw KotlinNullPointer`() {
59+
fun `assertAll with collection of functions that throw AssertionErrors`() {
60+
val multipleFailuresError = assertThrows<MultipleFailuresError>("Should have thrown multiple errors") {
61+
assertAll(setOf({ assertFalse(true) }, { assertFalse(true) }))
62+
}
63+
assertExpectedExceptionTypes(multipleFailuresError, AssertionFailedError::class, AssertionFailedError::class)
64+
}
65+
66+
@Test
67+
fun `assertThrows with function that does not throw an exception`() {
6068
val assertionMessage = "This will not throw an exception"
6169
val error = assertThrows<AssertionFailedError>("assertThrows did not throw the correct exception") {
6270
assertThrows<IllegalStateException>(assertionMessage) { }
63-
// This should never execute
71+
// This should never execute:
6472
expectAssertionFailedError()
6573
}
6674
assertMessageStartsWith(error, assertionMessage)

0 commit comments

Comments
 (0)