Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How_to_Test_Server-side_Kotlin.pdf

Taro Nagasawa
September 11, 2018

 How_to_Test_Server-side_Kotlin.pdf

Kotlin Fest 2018 わいわい報告会 ( https://connpass.com/event/100752/ ) で発表したスライドです

Taro Nagasawa

September 11, 2018
Tweet

More Decks by Taro Nagasawa

Other Decks in Programming

Transcript

  1. JUnit5 class FooTest { @Nested inner class fooMethod { @Test

    fun `should throw exception`() { assertThrows<MyException>() { Foo().foo() } } } }
  2. class FooTest { @Nested inner class fooMethod { @Test fun

    `should throw exception`() { assertThrows<MyException>() { Foo().foo() } } } } JUnit5
  3. JUnit5 class FooTest { @Nested inner class fooMethod { @Test

    fun `should throw exception`() { assertThrows<MyException>() { Foo().foo() } } } }
  4. MockK interface UserRepository { suspend fun findUser(id: Long): User? }

    val userRepo = mockk<UserRepository>() every { userRepo.findUser(1) } returns user
  5. MockK interface UserRepository { suspend fun findUser(id: Long): User? }

    val userRepo = mockk<UserRepository>() every { userRepo.findUser(1) } returns user coEvery { userRepo.findUser(1) } returns user