JSF & Java Blog

Discussion on Java and JSF, including Spring, Maven, Eclipse and Jenkins


Maven pom Checkstyle configuration with Eclipse

In a previous post on Eclipse plugins, two excellent plugins were mentioned which can automatically set up your Eclipse project to use the same Checkstyle configuration that is configured in your pom file. However, the only problem with both of these plugins is that they will only be able to find your Checkstyle configuration if […]


Useful Eclipse Plugins

A list of handy Eclipse plugins for the Eclipse IDE eCobertura – Allows Cobertura code coverage to be run from the IDE directly eclipse-cs – Enforces coding standards using the CheckStyle tool PMD – Scans Java code and reports potential problems M2Eclipse – Maven integration from Sonatype m2e-extensions – Works with version 0.10 of the […]


JSF, Iterating with tomahawk radio buttons, t:datalist, a4j:repeat

The standard JSF radio buttons h:selectOneRadio render a load of old school html (i.e. they use table tags to do layout, (all a bit 1996)). e.g. JSF h:selectOneRadio tag Code for #{radioOptions} Note: I’m using jboss seam in the example above, but you could easily remove the seam annotations and define the bean in using […]


Maven site generation error: DTDDVFactoryImpl does not extend from DTDDVFactory

When generating a site with Maven, we encountered the following exception when a particular reporting plugin was executed: This basically meant that an incompatible version of xerces was trying to be run. We have everything set to use Java 1.6, which ships with its own version of xerces. After some debugging, it was tracked down […]

3D Secure

3D Secure and the PaReq field in Google Chrome & Safari Browsers

I recently had to implement the 3D Secure payment system. In order to do this 3 fields must be sent to the 3D Secure ACS (Access Control Server) MD Term Url PaReq (Payer authentication request) Initally everything went well until we tested our pages in Google Chrome and Safari. Under both browsers the 3D Secure […]


Suppress logging in java unit tests

Here are a couple of different ways of suppressing logging when running unit tests. If you are using apache commons logging then you can suppress logging with the following code: If running your unit tests with JUnit, it is probably best to put this code in the setUp() method. However, if you only wanted it […]


Mocking Statics and IllegalStateException: no last call on a mock available

If you use PowerMock to mock a static object e.g. and encounter the following error: Check that you have prepared the Class for test using the @PrepareForTest annotation. e.g. An excellent article discussing mocking statics by one of the PowerMock developers can be found here: http://blog.jayway.com/2009/05/17/mocking-static-methods-in-java-system-classes/ Note that you also need to @PrepareForTest any classes […]


Cobertura code coverage with Maven and PowerMock

If you use Powermock for unit testing with Maven and Cobertura for code coverage, you are likely to be affected by the following issue noted on the PowerMock issue tracker. If you did not have the maven-surefire-plugin forkmode configured to ‘pertest’, you would find that any tests annotated with @RunWith(PowerMockRunner.class) had zero percentage code coverage […]


Chaining EasyMock’s expectation return values

Recently I discovered quite a handy feature of EasyMock’s IExpectationSetters andReturn method. You are able to chain the return values so that you can return different values each time that expectation is called. Chaining Easymock’s expectation return values becomes useful if you consider the following method, where Voucher is an object that cannot be instantiated […]