Best Advice I've Been Given: Check Your Ego

The Red Hat twitter account just asked this question: "Communities grow by uplifting others. What is one piece of advice you’d offer to a new developer? Reply below and then check out some advice from #RedHatter @somalley108." Here’s my input. As a general rule, if you’re writing software, you’re probably pretty intelligent. That intelligence, while important, of course, can also become a hindrance. For example, I’.....

Read More ›

Dear MockK, Repeat After Me

The project I’m working on is using Mockk in the unit tests. It’s a great library that has made true unit testing so much easier. I ran into a problem, though, where I needed a method I was mocking to return the value it was receiving. To be more specific, we were passing an object to a Spring repository method that had been built inside the method to test, and, to.....

Read More ›

Merry Christmas, 2019

Merry Christmas! For God so loved the world, that He gave His only begotten Son, that whoever believes in Him shall not perish, but have eternal life. -- John 3:16...

Read More ›

Executable Kotlin Scripts

A user in #kotlin on Freenode asked how to run a Kotlin script. While the Kotlin docs are pretty clear on how to do that, I thought I’d make a quick post to show how to make an easily executable Kotlin script. The first step is to name the file with a .kts extension: test.kts println("Hello, world!") You can then run it like this: $ kotlinc -script test.kts Hello, world! That.....

Read More ›

Testing Spring Repositories with Flyway

With my recent job change, I’ve gotten a chance to use Spring Boot in anger a bit. It’s been fun, and I’ve learned a fair bit about the current state of Spring (I still love you, Jakarta EE!). One of my tasks involved adding a query method to a repository, and I wanted to make sure the query worked before I pushed it upstream. To do that confidently, of.....

Read More ›

When Testing with a Different Database Chokes on Your DDL

I recently found myself writing a test that needed a database. Unfortunately, our testing database, H2, doesn’t support all of the features of our production database, PostgreSQL. This meant that the Flyway migrates used to manage the production database broke in the testing environment. The fix for this turned out to be pretty simple. To set the scenario, imagine you have this table: CREATE TABLE foo ( id bigint PRIMARY KEY, some_json JSONB ); The.....

Read More ›

Easily Switching JDKs

Development environments can get fairly complex, and making sure you’re using the right version of some library or another can be annoying on the best of days. I have a situation like that where my "day job" requires (still, and hopefully not for much longer) JDK 8, but my side projects, learning efforts, etc. can use a more modern version. Years ago, Charles Nutter shared a shell script he uses to switch JDKs.....

Read More ›

Java to Kotlin Conversion Question. And Answer.

Recently, in the #kotlin channel on Freenode, a user asked a question about what was happening to his Java code when using IDEA’s convert-to-Kotlin functionality. He left before anyone had the time to answer, and while he likely doesn’t read my blog, I’m going to answer his question here anyway. :) Here is his (slightly edited) question: I use intellij idea to convert a java code to kotlin.....

Read More ›

Getting started with Micronaut: Kotlin, JPA, and JWT

The Micronaut guides are really pretty good. So far, I’ve found just about everything I need. The biggest obstacle so far has been that, at times, the content was scattered across several guides and usually in the wrong language: I’m interested in Kotlin, but the guides seem to be mostly in Java or Groovy. This isn’t surprising, as budgets are limited, of course. What I would like to do.....

Read More ›

Kotlin+Micronaut and IDEA Don't Get Along Together

Recently, I’ve been experimenting with Micronaut, a new-ish "modern, JVM-based, full-stack framework for building modular, easily testable microservice and serverless applications" from the makers of Grail. So far, I’ve been really impressed. The documentation has been excellent, and the framework is very easy to get started with. I have, though, run in to some trouble writing tests, or, more accurately running tests. I spent far too much time.....

Read More ›