Extending A Java Library with Kotlin

preview_player
Показать описание

The resulting tests were more signal than noise though, so this week we look at extracting useful and reusable abstractions from the raw code. On the way we learn some useful techniques to extend a Java library with Kotlin.

In this episode

00:00:31 Reviewing the current code
00:01:43 The tests are still flakey
00:07:44 Extract extension functions
00:10:28 Review the test
00:10:50 Running the server on a random unused port
00:11:24 Cleaning up the server
00:11:46 Extracting boilerplate into a lifecycle function
00:14:05 Parameterising all the things
00:17:27 Extract utilities into their own file
00:19:41 Commit
00:19:56 Using null as a default parameter value
00:22:11 Amend commit
00:22:17 Using our utilities in an add item acceptance test
00:23:19 Reviewing the new test
00:24:01 Commit
00:24:35 Review

This is part 89 of an exploration of where a Test Driven Development implementation of the Gilded Rose stock control system might take us in Kotlin. You can see the whole series as a playlist
and the code on GitHub

If you like this, you’ll probably like my book Java to Kotlin, A Refactoring Guidebook
Рекомендации по теме
Комментарии
Автор

Thanks for another great video. Looking forward for more of them. :)

BTW waitingForHtmx contains error - variable name is wrong dataLoadedFired and it's also using == instead of = to assign the variable.

MarianSchubert
Автор

As we’ve come to expect of you, again another great showcase of step-by-step refactoring. 😍

TimSchraepen
Автор

22:21 This whole video was *wunderbar*. Thank you as always. I hadn't heard of Playwright before your last video but we're seriously considering using it instead of Cypress in the future, so that we can utilize Kotlin.

We don't make heavy use of browser-based tests as of now. Do you have any experience / best practices regarding state handling etc., e.g. when testing the integration of multiple integrated services? Or would you rather use browser tests only for an isolated frontend and fake out any integrated services?

JentaroYusong
visit shbcf.ru