Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
KotlinTest with Spring Boot
Search
Takehata Naoto
January 21, 2019
Programming
3
1.7k
KotlinTest with Spring Boot
2019年1月21日 「集まれKotlin好き!Kotlin愛好会 vol7」の談義資料です。
Takehata Naoto
January 21, 2019
Tweet
Share
More Decks by Takehata Naoto
See All by Takehata Naoto
KotlinConf 2025で発表された言語のアップデートと現地参加レポート
n_takehata
1
18
KotlinConf 2025 現地で感じたServer-Side Kotlin
n_takehata
1
220
KotlinConf 2025 現地参加の土産話
n_takehata
0
100
組織貢献をするフリーランスエンジニアという生き方
n_takehata
2
3.7k
「2024年版 Kotlin サーバーサイドプログラミング実践開発」の補講 〜O/Rマッパー編〜
n_takehata
2
690
2024年版 Kotlin サーバーサイドプログラミング実践開発
n_takehata
7
5.9k
Server-Side目線で見る、Kotlin Festの楽しみ方
n_takehata
0
480
KotlinとCloud Vision APIで領収書の電子帳簿保存法対応をする
n_takehata
1
1.5k
KotlinConf 2023 現地参加レポート
n_takehata
1
360
Other Decks in Programming
See All in Programming
Javaに鉄道指向プログラミング (Railway Oriented Pro gramming) のエッセンスを取り入れる/Bringing the Essence of Railway-Oriented Programming to Java
cocet33000
2
580
Prism.parseで 300本以上あるエンドポイントに 接続できる権限の一覧表を作ってみた
hatsu38
1
110
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
190
今ならAmazon ECSのサービス間通信をどう選ぶか / Selection of ECS Interservice Communication 2025
tkikuc
11
2.7k
Claude Codeの使い方
ttnyt8701
1
130
CursorはMCPを使った方が良いぞ
taigakono
0
130
A comprehensive view of refactoring
marabesi
0
970
無関心の谷
kanayannet
0
180
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
320
Enterprise Web App. Development (2): Version Control Tool Training Ver. 5.1
knakagawa
1
120
エラーって何種類あるの?
kajitack
5
260
Java on Azure で LangGraph!
kohei3110
0
160
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
KATA
mclloyd
29
14k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
32
5.9k
GraphQLとの向き合い方2022年版
quramy
46
14k
Automating Front-end Workflow
addyosmani
1370
200k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
A Tale of Four Properties
chriscoyier
159
23k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.8k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
137
34k
Transcript
: Twi%er:@n_takehata %)& +,#,!Kotlin +', $*,( +*"11
+
• Kotlin • Spring Boot • MyBatis
• KotlinTest • Gradle • gRPC
• Kotlin • Spring Boot • MyBatis
• KotlinTest • Gradle • gRPC
1 1 2 B 1 1 . 1 4
3
1 1 2 B 1 1 . 1 4
3
• / • : • K : //
. / / / ./ / / ./
testCompile('io.kotlintest:kotlintest-runner-junit5:3.1.7')
• •
•
( class SampleServiceForStringSpecTest : StringSpec() { init { val service
= SampleService() "execute param 1 one " { service.execute(1) shouldBe "one" } • • shouldBe KotlinTest
• FB • ) F FB • ( S
( class SampleServiceForBehaviorSpecTest : BehaviorSpec() { init { val service
= SampleService() given("execute") { `when`("param1 ") { val result = service.execute(1) then("one ") { result.shouldBe("one") }
• D • ( e B • 3 K
)( `
) ((
( class SampleServiceForAnnotationSpecTest : AnnotationSpec() { val service = SampleService()
@Test fun param1one() { service.execute(1) shouldBe "one" }
• KT @ U • J
• ( ) • K1 • K0
1 1 2 B 1 1 . 1 4
3
• •
class SampleServiceTest: StringSpec() { init { forall(
row(10, ""), row(100, "") ) { num, descrip8on -> "execute param ${descrip8on} " { val service = SampleService() service.execute(num) shouldBe true } } } }
• 1 • 1 • 1
class SampleServiceForStringSpecTest : StringSpec() { init { val service
= SampleService() "executeparam1one" { service.execute(1) shouldBe "one" } "f:executeparam2two" { service.execute(2) shouldBe "two" } } }
) (( 1
class SampleServiceForStringSpecTest : StringSpec() { init { val service
= SampleService() "executeparam1one" { service.execute(1) shouldBe "one" } "!executeparam2two" { service.execute(2) shouldBe "two" } } } !
) (( 2
• B • •
1 1 2 B 1 1 . 1 4
3
None
@ContextConfiguration(classes = [TestApplicationContext::class]) class UserServiceImplTest( private val userService:
UserService ): StringSpec() { init { ”getUserStatushogefuga" { // } } }
testCompile("io.kotlintest:kotlintest-extensions-spring:3.1.8")
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<ProjectLevelExtension> = listOf(SpringAutowireConstructorExtension) } • AbstractProjectConfig • ConstructorInjection
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<ProjectLevelExtension> = listOf(SpringAutowireConstructorExtension) } • io.kotlintest.provided • ProjectConfig •
1 1 2 B 1 1 . 1 4
3
• # $)" • (%*
• &+'!
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/.
201924 Java→Kotlin https://gihyo.jp/magazine/SD/archive/2019/201902