Why Does TDD Work for Functional Programming?

Coming from a Java developer, TDD is always important. It is actually easier to do it for functional programming. I'll show you how...Imagine you have a blank canvas in front of you. You’ve come up with the first requirement for a function you must write. This is likely…

TDD Requires More Than 100% Code Coverage

Let’s look at the definition of TDD: requirements are turned into very specific test cases, then the code is improved so that the tests passThis means that you write a test for the smallest possible use case, then write code to make it pass, and repeat. When you do…

Stay Away From @VisibleForTesting

STOPBest testing practices rely on focusing on code that is visible to external parties, whether that is another class, component, project, service, or product. If you find yourself wanting to test private methods or classes, rethink your design. The annotation @VisibleForTesting exists for two purposes: Notify other developers that the…

JavaDoc or Java Source?

One of my Twitter heroes asked a question this week: What if open-source framework didn't provide any JavaDoc? Would you enjoy using them? Just because the source code is readable, it doesn't mean code comments are useless.https://t.co/scRzGOp8fI — Vlad Mihalcea (@vlad_mihalcea)…

Format Joda Time in Thymeleaf Templates and WIN

If you use Thymeleaf templates in Spring Boot and want to include your Joda Time dates, it can be annoying. Why? Out of the box, to format dates in a template you have to get that done ahead of time, in the controller or service. This can cause some complexity…