JUnit Hamcrest: Matching a Group of Map Properties from Any Map within a List

Let’s say that you have an ArrayList of LinkedHashMaps. Let’s further say that you would like to find any Map within that List, which contains a set of Properties. Here is how you can write a Unit Test with Hamcrest Matchers to do this: Here we can see that we…

Continue reading

Handling Multiple Date Formats with One Method via Joda Time

Handling Multiple Date Formats with One Method via Joda Time

Nearly any project that amounts to anything must handle the processing of Dates, Times, and Timestamps. When it comes to Java projects, I see time and time again that developers just insert date formatters anywhere and everywhere. This violates the concept of modularity and making a segment of code do…

Continue reading