config derivation with ZIO config and Magnolia
Config derivation with ZIO config and Magnolia.
Config derivation with ZIO config and Magnolia.
As software engineers, we are constantly looking for ways to build faster, more scalable, and more efficient systems. But we often overlook one critical aspect: sustainability. Just as in sports, where long-term success comes from balancing peak performance with endurance, sustainable software engineering is about creating systems that not only perform well today but also remain viable and efficient in the future.
AssertJ already provides many useful assertions for all kind of types. But sometimes we want to define our own assertions for our own types. We can define new assertions by extending the AbstractAssert
class In this class we add methods that will check the values of our type. The names of the methods can reflect the domain model of our type. This can make our tests more readable and understandable.
To compare nested objects we can use the usingRecursiveComparison()
method in AssertJ. We can set up the nested objects with values we expect, invoke a method that would return the actual nested objects, and then use the usingRecursiveComparison()
method to compare the actual nested objects with the expected nested objects. This is a very clean way to compare nested objects. Also when we would add a new property to the nested objects our test would fail as we didn’t use that new property yet for our expected nested objects.
In our Tech Radar we put CloudEvents in the trial phase of the platforms quadrant. We’d like to take you on a journey and show you what CloudEvents are and how they can be used. In our Second blog about CloudEvents we showed you how they can be applied. In this third blog we will be looking at CloudEvent extensions, a means to extend the specification with propriatary properties!
In our Tech Radar we put CloudEvents in the trial phase. We’d like to take you on a journey and show you what CloudEvents are and how they can be used. In our First blog about CloudEvents we introduced you to the specification. In this second blog we will be looking at how CloudEvents can be used in practice!
In our Tech Radar we put CloudEvents in the trial phase. We’d like to take you on a journey and show you what CloudEvents are and how they can be used. In this first blog we will be looking at the CloudEvent specification and the serialized end result!
Join me for my first look into GitHub Codespaces. I’ll walk you through setting up some basic configuration, and some things to keep in mind.
The is
macro in the clojure.test
namespace can be used to write assertions about the code we want to test. Usually we provide a predicate function as argument to the is
macro. The prediction function will call our code under test and return a boolean value. If the value is true
the assertion passes, if it is false
the assertion fails. But we can also provide a custom assertion function to the is
macro. In the clojure.test
package there are already some customer assertions like thrown?
and instance?
. The assertions are implemented by defining a method for the assert-expr
multimethod that is used by the is
macro. The assert-expr
multimethod is defined in the clojure.test
namespace. In our own code base we can define new methods for the assert-expr
multimethod and provide our own custom assertions. This can be useful to make tests more readable and we can use a language in our tests that is close to the domain or naming we use in our code.
The clojure.test
namespace has the are
macro that allows us to combine multiple test cases for the code we want to test, without having to write multiple assertions. We can provide multiple values for a function we want to test together with the expected values. Then then macro will expand this to multiple expressions with the is
macro where the real assertion happens. Besides providing the data we must also provide the predicate where we assert our code under test. There is a downside of the are
macro and that is that in case of assertion failures the line numbers in the error message could be off.