Home TWIL 3
Post
Cancel

TWIL 3

Welcome to TWIL III

On this weeks episode of “This week I learned” we’ll be exploring a neat Kotlin library, along with some medical terms.

AssertJ is better than Hamcrest

A bit of a back story first. I’ve been using Hamcrest for advanced testing for the most part. Hamcrest expands the basic assert capability by adding a set of functions and matchers that can be used to unit test code. Although I have not submerged myself into the full capabilities of Hamcrest, I quickly fell in love with the library. Hamcrest offers some basic additions to the ol’ assert that makes life extremely easy. For example, look at the code snippet below:

1
2
3
4
5
6
7
8
9
data class Person(val name: String, val age: Number)

val paul = Person("Paul", 23)
val david = Person("David", 92)
val people = listOf(paul, david)

assertThat(paul.name, equalTo("Paul"))
assertThat(david.age, equalTo(92))
assertThat(people, hasItem(paul))

We can see the usage of keywords such as equalTo and hasItem. Both these are trivial and clinical in testing!

Although these features are amazing, I want to expand on one of its downfalls – imports. For each different matcher you need to import the matcher. That might sound silly, so allow me to elaborate on that. We have to know what to import before we can use a specific matcher. The obvious response to that statement is duhhh, you should know what you want to test. But as developers we want to do as much as possible with as little as much effort.1 That’s where AssertJ comes in!

AsssertJ enables us to append matchers to a given assertion function. This is easier to explain by example. Look at the code snippet below that is equivalent to the above snippet:

1
2
3
assertThat(paul.name).equalTo("Paul")
assertThat(david.age).equalTo(92)
assertThat(people),hasItem(paul)

The key difference here is that the matcher is appended to the assert. This allows us to firstly get a list of suggestions on an assert function (for most IDE’s) as well as import less matchers as these matchers are properties on the assert functions.

Along with these few imports that we need, we can also append assertions recursively! I think I’ll leave a deep dive for that for a separate post!

Septoplasty recovery

Without too much personal detail, I would like to expand on the healing process after a septoplasty. The first couple of days blockage, bleeding and swelling are expected as a specialist jammed some instruments in your nose and did their magic. This feature won’t expand on that.2

About 5 days after the surgery life can continue as semi-normal. You’re able to breathe again and it doesn’t hurt to sit up right. What I didn’t know is that the stents in your nose will bring extreme discomfort! Although these stents only stay in for a week, they do make you question some things.

After I had the stents removed along with a bit of cleaning I felt like a new person. I could breath without any issue, I could start to smell and taste chocolate and I saw light at the end of the tunnel. Boy was I wrong!

A core piece of information left out by the specialist is that the nose is an exceptional piece of biology and it will protect itself from everything. What I mean by this is that the nose builds up scar tissue to protect the new scars from infection and diseases. This scar tissue further blocks the nose and has to be kept wet to avoid the nasal opening from growing / healing shut. Keeping the tissue wet is achieved via a nasal cleanse done twice a day. While I had no issue with the nasal cleanse, I did have more and more irritation in my nose which made my days very lengthy.

After a quick phone call with the doc they told me that the healing process will take another 2-3 weeks. This process includes the scar tissue to stop generating (and dying) until the scars are fully healed. So I learned that surgery has quite a lengthy affect and should not be taken lightly.

Ps. All of this information is from my experience and my extremely basic understanding of the recovery after a septoplasty. Please phone a medical professional if you have any questions!

  1. Well, good developers! 

  2. Use ChatGPT or the boring old style way to learn more about this surgery. 

This post is licensed under CC BY 4.0 by the author.