Learning and testing design patterns in Java