enableAssertions=false does not work


(Achim Breunig) #1

I want to disable assertions for java tests. For this i used the following build.gradle snippet:

test {
   enableAssertions = false
   ignoreFailures = true
}

The

ignoreFailures

statement works fine, but the

enableAssertions

statement not. Assertions are always enabled.

Versions: ------------------------------------------------------------ Gradle 1.0-rc-2 ------------------------------------------------------------

Gradle build time: Tuesday, April 24, 2012 11:52:37 PM UTC Groovy: 1.8.6 Ant: Apache Ant™ version 1.8.2 compiled on December 20 2010 Ivy: 2.2.0 JVM: 1.6.0_31 (Sun Microsystems Inc. 20.6-b01) OS: Linux 3.1.6-gentoo-BR01 amd64


(Peter Niederwieser) #2

Works fine for me. Are you aware that this is about Java assertion statements, not about your usual test assertions?


(Achim Breunig) #3

Thanks for your quick reply.

Yes, the normal java assertion statements are still active.


(Peter Niederwieser) #4

Hard to imagine. Can you provide a self-contained build that allows to reproduce the problem?


(Achim Breunig) #5

I’ve just made a self-contained build and … it works fine. So I analyzed the tests and recognized that the problem was that some resource bundles where located in the src/main/java and not in src/main/test which resulted in the AssertionFailedError.

Since this worked in maven I did not look closely enough. shame Sorry and many thanks for your support