[jboss-cvs] JBossAS SVN: r64942 - trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree751/unit.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 29 03:33:12 EDT 2007
Author: ALRubinger
Date: 2007-08-29 03:33:11 -0400 (Wed, 29 Aug 2007)
New Revision: 64942
Modified:
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree751/unit/FailLocalRemoteSameInterfaceUnitTestCase.java
Log:
EJBTHREE-751: Correction of Unit Test to test for Exception type received, not underlying error message in wrapped exception (was failing)
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree751/unit/FailLocalRemoteSameInterfaceUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree751/unit/FailLocalRemoteSameInterfaceUnitTestCase.java 2007-08-29 07:31:12 UTC (rev 64941)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree751/unit/FailLocalRemoteSameInterfaceUnitTestCase.java 2007-08-29 07:33:11 UTC (rev 64942)
@@ -23,6 +23,7 @@
import junit.framework.Test;
+import org.jboss.deployment.DeploymentException;
import org.jboss.test.JBossTestCase;
/**
@@ -43,31 +44,37 @@
// do not deploy any jars
return getDeploySetup(FailLocalRemoteSameInterfaceUnitTestCase.class, null);
}
-
+
@Override
protected void tearDown() throws Exception
{
undeploy("ejbthree751-fail.jar");
super.tearDown();
}
-
+
public void testDeploymentFailure() throws Exception
{
+ // Define expected exception
+ Class exceptionExpected = DeploymentException.class;
+
try
{
redeploy("ejbthree751-fail.jar");
fail("should throw an exception");
}
- catch(Exception e)
+ catch (Exception e)
{
- for(Throwable t = e;t != null; t = t.getCause())
+ // Ensure expected error is thrown
+ if (e.getClass().equals(exceptionExpected))
{
- // See ProxyFactoryHelper.getLocalInterfaces
- if(t.getMessage().contains("EJB3 Spec 4.6.7, Bullet 5.4"))
- return;
+ // Log Success for clarity
+ log.info("testDeploymentFailure SUCCESS; \"" + exceptionExpected.getName() + "\" received");
+ return;
}
- e.printStackTrace();
- fail("Exception did not contain expected message");
+
+ // Proper exception was not thrown
+ log.error(e);
+ fail("Exception received, " + e.getClass().getName() + ", was not expected : " + exceptionExpected.getName());
}
}
}
More information about the jboss-cvs-commits
mailing list