Tag Archives: maven

How to use JUnit4 Hamcrest Matchers

JUnit borrows matchers from a library called Hamcrest, which look a lot like RSpec matchers in Ruby. They can be tricky to write, but end up being much more readable for complex assertions. At its simplest case, we can turn this assertion assertTrue(board.isGameOver()); into assertThat(board.isGameOver(), is(true)); It’s slightly wordier, but I think it reads in […]

Using Eclipse WTP with Maven’s eclipse:eclipse Goal

If you use Maven’s “eclipse:eclipse” goal to generate a project descriptor for eclipse, by default you’re just going to get a plain Java project. You’ll have to add in the Dynamic Web facet in order to tell Eclipse that you can deploy this project in a web container. The easy way around this is to […]