Slide 1

Slide 1 text

Slide 2

Slide 2 text

: Twi%er:@n_takehata %)& +,#,!Kotlin +', $*,( +*"11 +

Slide 3

Slide 3 text

• Kotlin • Spring Boot • MyBatis • KotlinTest • Gradle • gRPC

Slide 4

Slide 4 text

• Kotlin • Spring Boot • MyBatis • KotlinTest • Gradle • gRPC

Slide 5

Slide 5 text

Slide 6

Slide 6 text

1 1 2 B 1 1 . 1 4 3

Slide 7

Slide 7 text

1 1 2 B 1 1 . 1 4 3

Slide 8

Slide 8 text

Slide 9

Slide 9 text

• / • : • K : // . / / / ./ / / ./

Slide 10

Slide 10 text

testCompile('io.kotlintest:kotlintest-runner-junit5:3.1.7')

Slide 11

Slide 11 text

Slide 12

Slide 12 text

• • •

Slide 13

Slide 13 text

Slide 14

Slide 14 text

( class SampleServiceForStringSpecTest : StringSpec() { init { val service = SampleService() "executeparam 1one " { service.execute(1) shouldBe "one" } • • shouldBe KotlinTest

Slide 15

Slide 15 text

• FB • ) F FB • ( S

Slide 16

Slide 16 text

Slide 17

Slide 17 text

( class SampleServiceForBehaviorSpecTest : BehaviorSpec() { init { val service = SampleService() given("execute") { `when`("param1 ") { val result = service.execute(1) then("one ") { result.shouldBe("one") }

Slide 18

Slide 18 text

• D • ( e B • 3 K )( `

Slide 19

Slide 19 text

) ((

Slide 20

Slide 20 text

Slide 21

Slide 21 text

( class SampleServiceForAnnotationSpecTest : AnnotationSpec() { val service = SampleService() @Test fun param1one() { service.execute(1) shouldBe "one" }

Slide 22

Slide 22 text

• KT @ U • J

Slide 23

Slide 23 text

Slide 24

Slide 24 text

• ( ) • K1 • K0

Slide 25

Slide 25 text

1 1 2 B 1 1 . 1 4 3

Slide 26

Slide 26 text

Slide 27

Slide 27 text

• •

Slide 28

Slide 28 text

Slide 29

Slide 29 text

class SampleServiceTest: StringSpec() { init { forall( row(10, ""), row(100, "") ) { num, descrip8on -> "execute param${descrip8on} " { val service = SampleService() service.execute(num) shouldBe true } } } }

Slide 30

Slide 30 text

• 1 • 1 • 1

Slide 31

Slide 31 text

Slide 32

Slide 32 text

class SampleServiceForStringSpecTest : StringSpec() { init { val service = SampleService() "executeparam1one" { service.execute(1) shouldBe "one" } "f:executeparam2two" { service.execute(2) shouldBe "two" } } }

Slide 33

Slide 33 text

) (( 1

Slide 34

Slide 34 text

class SampleServiceForStringSpecTest : StringSpec() { init { val service = SampleService() "executeparam1one" { service.execute(1) shouldBe "one" } "!executeparam2two" { service.execute(2) shouldBe "two" } } } !

Slide 35

Slide 35 text

) (( 2

Slide 36

Slide 36 text

• B • •

Slide 37

Slide 37 text

1 1 2 B 1 1 . 1 4 3

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

Slide 40

Slide 40 text

@ContextConfiguration(classes = [TestApplicationContext::class]) class UserServiceImplTest( private val userService: UserService ): StringSpec() { init { ”getUserStatushogefuga" { // } } }

Slide 41

Slide 41 text

Slide 42

Slide 42 text

Slide 43

Slide 43 text

testCompile("io.kotlintest:kotlintest-extensions-spring:3.1.8")

Slide 44

Slide 44 text

package io.kotlintest.provided import io.kotlintest.AbstractProjectConfig import io.kotlintest.extensions.ProjectLevelExtension import io.kotlintest.spring.SpringAutowireConstructorExtension class ProjectConfig : AbstractProjectConfig() { override fun extensions(): List = listOf(SpringAutowireConstructorExtension) } • AbstractProjectConfig • ConstructorInjection

Slide 45

Slide 45 text

Slide 46

Slide 46 text

package io.kotlintest.provided import io.kotlintest.AbstractProjectConfig import io.kotlintest.extensions.ProjectLevelExtension import io.kotlintest.spring.SpringAutowireConstructorExtension class ProjectConfig : AbstractProjectConfig() { override fun extensions(): List = listOf(SpringAutowireConstructorExtension) } • io.kotlintest.provided • ProjectConfig •

Slide 47

Slide 47 text

Slide 48

Slide 48 text

Slide 49

Slide 49 text

1 1 2 B 1 1 . 1 4 3

Slide 50

Slide 50 text

Slide 51

Slide 51 text

• # $)" • (%* • &+'!

Slide 52

Slide 52 text

B B 8 2 8 2 / 8 2 9:2 0 88 K S T 1 9 - 80 99 2-8 .8 9 2 / 2 0 2 8 2 9:2 0-88 2 1 8 2 / 8 2 / K 9/.K 1 9 - 80 /1 / 02 //: .8 / : : 8 2 / 9/.

Slide 53

Slide 53 text

Slide 54

Slide 54 text

Slide 55

Slide 55 text

201924 Java→Kotlin https://gihyo.jp/magazine/SD/archive/2019/201902