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 cause while there are no standardized CDI deployment-related exceptions (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