2024.03.13 15:17
https://kotest.io/docs/assertions/assertions.html
Assertions
name shouldBe "eunbin"// == assertThat(name).isEqualTo("eunbin")
Inspectors
mylist.forExactly(3) { it.city shouldBe "Chicago"}
val xs = listOf("sam", "gareth", "timothy", "muhammad") xs.forAtLeast(2) { it.shouldHaveMinLength(7)}
Exceptions
shouldThrow { // code in here that you expect to throw an IllegalAccessException}// == assertThrows { }
val exception = shouldThrowAny { // test here can throw any type of Throwable!}