I am using JDK1.4 assert statements in TestNG test. When I try to compile the test using Maven 2.0 (mvn test-compile), it doesn't recognize assert statement and give compilation failure : "BasicTest.java:[28,15] ';' expected " on the following code.
public void basicTest() { int cnt = getCount(); assert cnt > 0 : "COUNT NOT GREATER THAN ZERO"; }
Surefire enables the assertion by default so I don't need to specify it in POM surefire plugin configuration. But I did try that too but it's still not working.
Not sure why it's failing. Please help? (I am able to compile the code using javac command)
Here's part of my POM <project> ... <build> <sourceDirectory>src/</sourceDirectory> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire- plugin</artifactId> <configuration> <groups>basic</groups> </configuration> </plugin> </plugins> </build> ... </project>