Custom fluent assertions with AssertJ
More often than not, developers put much less attention to the test code than to the production code. Libraries and frameworks, fluent APIs or just clean code in general are terms we usually connect with actual production code and not with tests. But investing some time to use them in test code can pay off very quickly.
Read MoreUndoing in Git
Git is probably the most popular distributed version control system. When used properly, it allows a team to be extremely effective. When misused, it can create a total mess out of the code base. Every now and then you end up in a situation, when you have to undo your actions — it can include invalid file edits or deletions or even improperly executed Git commands.
Read MoreSome short thoughts on strategy pattern
Strategy is one of the most useful design patterns, which allows us to change algorithms or implementations of an operation during runtime. Typical use cases include validating or parsing data depending on some decisions made on the fly. And although the pattern is widely described in various sources and well known amongst programmers I think there is still a missing part in great number of examples we can find. Let me explain what I have in mind…
Read MoreAutomated validation of DB schema migrations
Object Relational Mapping frameworks, such as Hibernate, very often provide a way to automatically generate the database schema based on persistent classes. While it is very convenient as a proof of concept or for very simple applications, it is not a production ready approach. In reality you have to write scripts to version your schema … Continue reading "Automated validation of DB schema migrations"
Read MoreDealing with Value Objects in REST API with Jackson
Dealing with serialization and deserialization of ValueObjects with Jackson seems to be straightforward, right? It’s very common to expose REST API in our applications and JSON format is one of the most frequently used ones. How do we usually do it?
Read MoreEffective RESTful search API in Spring
Flexible RESTful search is very often a must-have for a web application. While the concept is easy and not new, it is very often implemented in a repetitive and tedious way. In this post I will demonstrate an effective way of implementing search API with Spring Data and Specification Argument Resolver. Naive approach With Spring … Continue reading "Effective RESTful search API in Spring"
Read MoreBuilder pattern revisited
The idea behind builder pattern is actually quite simple – it should help you to build your objects. But let me show you today why it is so important to use and how we can adjust it with some implementation tricks to achieve different goals and coding styles.
Read More