Showing posts with label Guava Predicate. Show all posts
Showing posts with label Guava Predicate. Show all posts

Thursday, January 3, 2013

Hamcrest Matchers, Guava Predicate and Builder design pattern



Hi coding addicts :)

Often, while coding we have to deal with some POJO objects that have dozens of fields in them. Many times we initialize those classes through a constructor having dozens of arguments which is terrible in any possibly imaginable way :) Apart from that the functions that use those constructors are hardly testable. Let's take a closer look at using a Builder to change that situation, together with Hamcrest matchers and Guava Predicates to unit test it.

Let's start off with taking a look at the POJO class.