>>>>> On Mon, 06 Feb 2012 09:36:00 -0600, Manfred Riem <manfred.riem_at_oracle.com> said:
MR> Hi all,
MR> For our integration and unit testing we really need to make sure that
MR> our tests fail instead of error out.
MR> What that means is that if you are expecting an Exception you assert
MR> that the exception happens. It also means that if your test errors out
MR> because some setups fails you will need to readjust the code so it
MR> asserts a particular environment.
MR> Eg.
MR> 1. UIComponent found = component.getChildren().get(0);
MR> 2. assertNotNull(found);
MR> The example above can error out because the number of
MR> children could be 0, in which case this test would error
MR> out at line 1 instead of fail at line 2.
MR> There are more than one way to solve the above problem
MR> but a way could be:
MR> assertTrue(component.getChildren().size() > 0);
MR> UIComponent found = component.getChildren().get(0);
MR> assertNotNull(found);
MR> Note we are guarding against the possibility here the
MR> number of children is actually 0.
MR> If you have any questions, don't hesitate to ask me.
These are good guidelines. Please consider if it makes sense for adding
it to the Mojarra faq, linked at <
http://jsf.java.net/faq>.
Ed
--
| edward.burns_at_oracle.com | office: +1 407 458 0017
| homepage: | http://ridingthecrest.com/