Assertions should be enabled when running our test cases.

I have added an AssertionTestCase to the spi module that will cause the build to fail if assertions are not enabled.
--
Jeremy

On Jul 20, 2006, at 9:36 AM, Raymond Feng wrote:

Hi,

I ran into some test case failures with the trunk code in both Eclipse and Maven (reported by my continumm build) related to the usage of java assertions.

For example, in test case "org.apache.tuscany.spi.extension.ReferenceTestCase", we have the following test:

public void testPrepare() throws Exception {
   TestReference ref = new TestReference(null, null, null);
   try {
ref.prepare(); //[rfeng] We assume the assert will catch null before it moves on to NPE
       fail();
   } catch (AssertionError e) {
       //expected // [rfeng] NPE is thrown if assertion is not enabled
   }
}

By default, assertions are disabled by JVM unless you explicitly turned it on using "-ea" option on the VM (In Eclipse, you need to set the VM arguments either at the JRE or test case.profile level. For Maven, you may need to set MAVEN_OPTS to include -ea). As a result, the test case fails because it throws NullPointerException instead of AssertionError.

Should we improve these test cases to be more robust?

Thanks,
Raymond

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to