相关疑难解决方法(0)

如何在gradle测试中禁用断言

我使用带有disableassertions的JAVA_OPTS,但是当gradle test运行时,仍然有输出java.lang.AssertionError.为什么?

build.gradle:

apply plugin: 'java'

apply plugin: 'eclipse'

apply plugin: "groovy"

dependencies {

    compile 'org.codehaus.groovy:groovy-all:2.3.6'  // for compile groovy
    compile "org.springframework:spring-core:3.0.5.RELEASE"
    compile "org.springframework:spring-aop:3.0.5.RELEASE"
    compile "org.springframework:spring-asm:3.0.5.RELEASE"
    compile "org.springframework:spring-beans:3.0.5.RELEASE"
    compile "org.springframework:spring-context:3.0.5.RELEASE"
    compile "org.springframework:spring-expression:3.0.5.RELEASE"
    compile "org.springframework:spring-jdbc:3.0.5.RELEASE"
    compile "org.springframework:spring-orm:3.0.5.RELEASE"
    compile "org.springframework:spring-test:3.0.5.RELEASE"
    compile "junit:junit:4.+"
}
Run Code Online (Sandbox Code Playgroud)

gradle test 产量

:booking:processResources UP-TO-DATE 

:booking:classes

:booking:jar

:compileJava

:compileGroovy

:processResources UP-TO-DATE

:classes

:compileTestJava UP-TO-DATE

:compileTestGroovy

:processTestResources UP-TO-DATE

:testClasses

:test

ScriptTester > testHandle FAILED
    java.lang.AssertionError at ScriptTester.groovy:127
Run Code Online (Sandbox Code Playgroud)

assert gradle

4
推荐指数
1
解决办法
2116
查看次数

标签 统计

assert ×1

gradle ×1