Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Kotlinでweld-junitを使ったら思ったように動かなかった話
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
kazusato
September 06, 2019
190
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Kotlinでweld-junitを使ったら 思ったように動かなかった話
2019/9/6 JJUG LT
kazusato
September 06, 2019
More Decks by kazusato
See All by kazusato
【RSGT2018】ウォーターフォール 大規模プロジェクトの中で スクラムでチーム運営をやってみた
kazusato
0
2.4k
Featured
See All Featured
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.2k
BBQ
matthewcrist
90
10k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Amusing Abliteration
ianozsvald
1
350
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
400
Embracing the Ebb and Flow
colly
88
5.2k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.7k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
260
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
Transcript
Kotlinでweld-junitを使ったら 思ったように動かなかった話 @kazusato 2019/9/6 JJUGナイトセミナーLT大会
タイトル「未定」で申し込んでいて、もともとは別の話 をしようと思ってました。 が、LTタイトルの一覧を見てびっくり。 ネタがかぶってる・・・
ほかに話せるネタあるかな??? ・jibでコンテナビルドしてはまった話 ・KotlinでCDIのテストを書こうとしてはまった話 ・・・どっちもニッチな話題だなあ。。。 LTだし、まあいいか。 というわけで、KotlinでCDIのテストを書こうとしては まった話をします。
サーバーサイドKotlinだと、KtorみたいなKotlin固有のフ レームワークを使うか、Spring Bootを使う、というケー スが多いと思います。 が、ちょっと身近にJava EE(JAX-RS)で書かれた資産 がそこそこある関係で、Kotlin+JAX-RSでコードを書い てました。 Java EEなんでCDIを使っていて、デプロイせずにテスト
したいよなーということで、weld-junitを使おうとしまし た。
weld-junit The primary goal of this project is to provide
simple and fast tools for CDI unit/component testing. The tools are implemented as JUnit 4 and JUnit 5 extensions. Supports Weld 2.4 (CDI 1.2) and 3.0 (CDI 2.0).
最初はWeldJunit5Extensionを使ってみた Javaのサンプルコードを見ながら、Kotlinで書いてみた。
しかし・・・動かない!!! インジェクションされない! (メッセージに出ているのはほかのクラスだけど、そもそもインジェクショ ンが機能してない)
なんで? いくら考えてもわからないので、とりあえずもう一つの方法を試した ら・・・ 動いた!
というわけで、テストはなんとかなったんですが、なんか気持ち悪い。 ちなみに、Javaで書くと当然動く。
なんで? バイトコードを見てみると・・・ Java Kotlin なんだこれ?
コンパイラーのソースを読んでみたら・・・