Thursday, 12 February 2026

AssertJ + AutoCloseableSoftAssertions + Kotlin

I've been playing around with AutoCloseableSoftAssertions, as I don't want to have to remind myself to call .assertAll()

But I also wanted to see if I can replace entire rows of assertThat statements in a simple manner, without many changes.

And I think I have found a way in Kotlin.

Let's start with the basics:

Let's try some SoftAssertions, so we can have many asserts that are all evaluated, instead of the Test stopping upon the first failed assert.

Okay, now AutoCloseableSoftAssertions is a convenient class that calls the .assertAll() as part of the final block in a try-with-resources:

Now, in the case above, we have to prefix our assertThat() calls with "it.". There's one more step that we can use to remove this.

Wrapping all this in a function for easy use will end up in:

Now, a stack of assertThat() statements can be encompassed with assertAll{} without any other changes to get the full advantages of SoftAssertions.

Might be overkill, but this was a fun example in Kotlin.

Try-with-resources

So you might have noticed that AutoClosableSoftAssertions is used in a try-with-resources block.

The small advantage you have, is that if there is an unexpected Exception thrown during your asserts, the ".assertAll()" will still be called, because it's part of the "AutoCloseable.close()".

I don't know how much this advantage is, as the unexpected Exception breaks the test anyways, but there it is.

Thursday, 5 February 2026

Retrieving Bookmarks from your Firefox - The Hard Way

Yeah, so I turned my old workstation into a server and no longer have access using a graphical interface.

Normally, this is fine, as I am using it as a server.

But I forgot to export my Firefox bookmarks.

Hopefully I can examine the sqllite database using reference [1] to retrieve my bookmarks.

I open the file /home/mrbear/.mozilla/firefox/xvosm5y9.default/places.sqlite and selecting the tab "Browse data" found the table moz_bookmarks.

It contains all bookmarks and folders and contains references to the moz_places table (using the moz_bookmarks.fk).

The moz_places table contains the actual urls.

References

[1] DB Browser for SQLLite
https://sqlitebrowser.org