Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

enabling assertions in ant

I want to enable the assertion facility in ant. In my ant build.xml, I put the follows, trying to enable assertions.

<project> ... <assertions> <enable/> </assertions> </project>

I put assertion in a junit file, which includes only one function,

testAssertions() {
  assert false;
}

when running ant, assertion fails are not thrown.. How to enable assertion in this setting?

like image 427
Richard Avatar asked Dec 26 '22 18:12

Richard


1 Answers

It looks like your <assertions> subelement is a child of <project>, is this correct?

I am assuming that you are running the test via the <junit> ant task. If this is correct, making the <assertions><enable/></assertions> subelement a child of <junit> should work.

like image 146
Justin Muller Avatar answered Jan 13 '23 11:01

Justin Muller