I am for making these types of tests consistent among projects and
@ShouldThrowException(Exception.class) seems to be right approach. AFAIK
the only reason it's not used in Seam Compat and Weld is that is was not
available / reliable enough on different containers at the time the
tests were written.
If this discussion leads to conclusion that Seam Compat and Weld should
align, could you file jira tasks please?
On 09/21/2011 12:54 PM, Martin Kouba wrote:
Hi,
recently during CDI TCK arquillian migration (1.1 branch) we had to
replace test harness @ExpectedDeploymentException in tests expecting
deployment failure.
So currently in TCK we use @ShouldThrowException(Exception.class) on
arquillian deployment method. Indeed testing generic Exception is not
the best solution but in fact right now we cannot test exact
deployment causewhile there are no standardized CDI
deployment-relatedexceptions (in CDI 1.1 there will be - see CDI-118
Standardize deployment-related exception classes). Also note that
"Adding this annotation will force @{@link Deployment} to be testable
= false which will force @{@link RunAsClient}".
The other possibility is to use something like Assert.fail("Deployment
should have failed...") or assert false in test method. Seam
Compatibility and Weld use this approach.
The question is whether to standardize this among all cdi/weld/seam
tests. I think we should use the arquillian way
(@ShouldThrowException) while its more obvious that we expect
deployment failure and use relevant expected exceptions as soon as CDI
1.1 arrives.
WDYT?
M
--
Martin Kouba
JBoss Quality Assurance Engineer
E-mail:mkouba@redhat.com
Web:www.cz.redhat.com
Red Hat Czech s.r.o., Purkyňova 99/71, 612 45, Brno, Czech Republic