Включение Java `assert` в Gradle/junitJAVA

Программисты JAVA общаются здесь
Anonymous
Включение Java `assert` в Gradle/junit

Сообщение Anonymous »

Мой проект использует Gradle и Junit 5.01. Утверждения Юнита работают нормально. Тем не менее, мои регулярные утверждения Java в самом протестированном коде не стреляют. Я ожидаю, что неудачная утверждение бросила утверждение, которое будет пойман и сообщено Junit.buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.2'
}
}

apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'maven'
apply plugin: 'org.junit.platform.gradle.plugin'

compileJava {
options.compilerArgs += "-Xlint:unchecked"
}

tasks.withType(Test) {
enableAssertions = true
}

repositories {
mavenCentral()
}

dependencies {
testCompile('org.junit.jupiter:junit-jupiter-api:5.0.1')
testCompile('org.apiguardian:apiguardian-api:1.0.0')
testRuntime('org.junit.jupiter:junit-jupiter-engine:5.0.1')
}

// Define the main class for the application
mainClassName = 'CMS'

jar {
manifest {
attributes 'Implementation-Title': 'CMS',
'Main-Class': 'com.brandli.cms.CMS'
}
}

junitPlatform {
filters {
includeClassNamePattern '.*'
}
}

test {
testLogging {
exceptionFormat = 'full'
}
}
< /code>

Что я делаю неправильно? < /p>

Подробнее здесь: https://stackoverflow.com/questions/481 ... adle-junit

Вернуться в «JAVA»