Commit 4fbf441b authored by MarkG's avatar MarkG Committed by TIGERs GitLab
Browse files

[build] Migrate to JUnit5, remove test config from not-tested modules

See merge request main/Sumatra!1483

sumatra-commit: 1e3d10922cb86f46198ad3ce7b82d9f6c13173f2
parent c37abeab
Pipeline #17355 failed with stage
in 3 minutes and 24 seconds
......@@ -5,11 +5,3 @@
plugins {
id 'groovy-gradle-plugin'
}
repositories {
gradlePluginPortal() // so that external plugins can be resolved in dependencies section
}
dependencies {
implementation 'gradle.plugin.com.google.protobuf:protobuf-gradle-plugin:0.8.15'
}
\ No newline at end of file
......@@ -4,14 +4,15 @@
plugins {
id 'java'
id 'groovy' // apply to all due to issues when only applying to some projects
id 'jacoco'
id 'idea'
id 'ca.cutterslade.analyze'
id 'sumatra.version-conventions'
id 'sumatra.versions'
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
java.targetCompatibility = JavaVersion.VERSION_17
java.sourceCompatibility = JavaVersion.VERSION_17
repositories {
maven {
......@@ -29,41 +30,8 @@ tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
test {
exclude '**/*IntegrationTest.class'
}
jacoco {
toolVersion = "0.8.7"
}
jacocoTestReport {
reports {
xml.required = true
csv.required = false
html.required = false
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it,
exclude: ['**/proto/**/*'])
}))
}
}
dependencies {
annotationProcessor "org.projectlombok:lombok:1.18.22"
compileOnly "org.projectlombok:lombok:1.18.22"
permitUnusedDeclared "org.projectlombok:lombok:1.18.22"
}
analyzeClassesDependencies {
// Set to false until up-to-date check works again (bug in plugin)
logDependencyInformationToFiles = false
}
analyzeTestClassesDependencies {
// Set to false until up-to-date check works again (bug in plugin)
logDependencyInformationToFiles = false
}
......@@ -8,7 +8,7 @@ plugins {
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.19.3'
artifact = 'com.google.protobuf:protoc:3.19.4'
}
// https://github.com/google/protobuf/issues/2054
generateProtoTasks {
......
plugins {
id 'jacoco'
}
dependencies {
// Support old junit4 syntax for now
testImplementation 'junit:junit:4.13.2'
// Support junit 5
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
permitTestUnusedDeclared 'org.junit.jupiter:junit-jupiter:5.8.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.8.2'
// Add common test tools
testImplementation 'org.assertj:assertj-core:3.22.0'
permitTestUnusedDeclared 'org.assertj:assertj-core:3.22.0'
testImplementation 'org.mockito:mockito-all:1.10.19'
permitTestUnusedDeclared 'org.mockito:mockito-all:1.10.19'
}
test {
useJUnitPlatform()
reports {
junitXml.required = true
html.required = true
}
exclude '**/*IntegrationTest.class'
}
jacoco {
toolVersion = "0.8.7"
}
jacocoTestReport {
reports {
xml.required = true
csv.required = false
html.required = false
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it,
exclude: ['**/proto/**/*'])
}))
}
}
plugins {
id 'groovy'
id 'jacoco'
id 'sumatra.test'
}
dependencies {
// Specific groovy version
testImplementation platform('org.codehaus.groovy:groovy-bom:3.0.9')
testImplementation 'org.codehaus.groovy:groovy'
testRuntimeOnly 'org.codehaus.groovy:groovy-templates'
testRuntimeOnly 'org.codehaus.groovy:groovy-xml'
testRuntimeOnly 'org.codehaus.groovy:groovy-json'
// Spock
testImplementation platform('org.spockframework:spock-bom:2.0-groovy-3.0')
testImplementation 'org.spockframework:spock-core'
}
......@@ -3,7 +3,7 @@
*/
plugins {
id 'sumatra.java-conventions'
id 'sumatra.java'
id 'java-library'
}
......
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%d %p [%t|%c{1}] %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="all">
<AppenderRef ref="CONSOLE"/>
</Root>
</Loggers>
</Configuration>
......@@ -3,7 +3,8 @@
*/
plugins {
id 'sumatra.java-conventions'
id 'sumatra.java'
id 'sumatra.test'
id 'java-library'
}
......@@ -13,7 +14,4 @@ dependencies {
implementation 'commons-lang:commons-lang:2.6'
implementation 'com.sleepycat:je:18.3.12'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.assertj:assertj-core:3.22.0'
}
......@@ -3,7 +3,7 @@
*/
plugins {
id 'sumatra.java-conventions'
id 'sumatra.java'
id 'java-library'
}
......@@ -11,7 +11,7 @@ dependencies {
implementation project(':common-gui')
implementation 'com.github.g3force:configurable:3.0'
implementation 'com.github.g3force:String2ValueConverter:2.2'
implementation 'com.github.g3force:String2ValueConverter:2.2.1'
implementation 'commons-configuration:commons-configuration:1.10'
implementation 'com.miglayout:miglayout-swing:11.0'
......
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%d %p [%t|%c{1}] %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="all">
<AppenderRef ref="CONSOLE"/>
</Root>
</Loggers>
</Configuration>
......@@ -3,7 +3,7 @@
*/
plugins {
id 'sumatra.java-conventions'
id 'sumatra.java'
id 'java-library'
}
......
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%d %p [%t|%c{1}] %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="all">
<AppenderRef ref="CONSOLE"/>
</Root>
</Loggers>
</Configuration>
......@@ -3,12 +3,14 @@
*/
plugins {
id 'sumatra.java-conventions'
id 'sumatra.java'
id 'sumatra.test'
id 'sumatra.test.spock'
id 'java-library'
}
dependencies {
implementation 'com.github.g3force:String2ValueConverter:2.2'
implementation 'com.github.g3force:String2ValueConverter:2.2.1'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'commons-lang:commons-lang:2.6'
......@@ -19,9 +21,7 @@ dependencies {
api 'com.googlecode.json-simple:json-simple:1.1.1'
implementation 'net.jafama:jafama:2.3.2'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.assertj:assertj-core:3.22.0'
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.8.2'
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.9'
testImplementation 'com.google.guava:guava:31.0.1-jre'
......
/*
* Copyright (c) 2009 - 2022, DHBW Mannheim - TIGERs Mannheim
*/
package edu.tigers.sumatra.math
import spock.lang.Specification
class SumatraMathSpec extends Specification {
def "#number has digits after decimal: #hasDigits"() {
expect:
SumatraMath.hasDigitsAfterDecimalPoint(number) == hasDigits
where:
number | hasDigits
1.0 | false
1.22 | true
-1.02 | true
-1.0 | false
}
def "even distribution with #n in [#min, #max] is #result"() {
expect:
SumatraMath.evenDistribution1D(min, max, n) == result
where:
min | max | n | result
0 | 3 | 3 | [0.5d, 1.5, 2.5]
0 | 0 | 0 | []
0 | 0 | 1 | [0]
0 | 0 | 2 | [0, 0]
0 | 1 | 0 | []
0 | 1 | 1 | [0.5]
0 | 2 | 2 | [0.5, 1.5]
}
def "square of #x is #x2"() {
expect:
SumatraMath.square(x) == x2
where:
x | x2
0 | 0
1 | 1
2 | 4
3 | 9
-1 | 1
-2 | 4
}
}
......@@ -3,7 +3,8 @@
*/
plugins {
id 'sumatra.java-conventions'
id 'sumatra.java'
id 'sumatra.test'
id 'java-library'
}
......@@ -11,7 +12,7 @@ dependencies {
api project(':common-math')
implementation 'com.github.TIGERs-Mannheim.matlabcontrol:matlabcontrol:4.1.2'
implementation 'com.github.g3force:String2ValueConverter:2.2'
implementation 'com.github.g3force:String2ValueConverter:2.2.1'
implementation 'commons-lang:commons-lang:2.6'
implementation 'org.apache.commons:commons-math3:3.6.1'
......@@ -25,9 +26,6 @@ dependencies {
implementation 'net.jafama:jafama:2.3.2'
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.assertj:assertj-core:3.22.0'
testImplementation 'org.openjdk.jmh:jmh-core:1.34'
testAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.34'
}
......
......@@ -3,9 +3,9 @@
*/
plugins {
id 'sumatra.java-conventions'
id 'sumatra.java'
id 'java-library'
id 'sumatra.protobuf-conventions'
id 'sumatra.protobuf'
}
sourceSets {
......@@ -37,7 +37,7 @@ dependencies {
implementation 'commons-lang:commons-lang:2.6'
implementation 'com.sleepycat:je:18.3.12'
implementation 'com.google.protobuf:protobuf-java:3.19.3'
implementation 'com.google.protobuf:protobuf-java:3.19.4'
integrationTestImplementation project(':common')
......@@ -49,16 +49,17 @@ dependencies {
integrationTestImplementation project(':moduli-record')
integrationTestImplementation 'junit:junit:4.13.2'
integrationTestRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.8.2'
integrationTestImplementation 'org.assertj:assertj-core:3.22.0'
integrationTestImplementation 'com.google.protobuf:protobuf-java:3.19.3'
integrationTestImplementation 'com.google.protobuf:protobuf-java-util:3.19.3'
integrationTestImplementation 'com.google.protobuf:protobuf-java:3.19.4'
integrationTestImplementation 'com.google.protobuf:protobuf-java-util:3.19.4'
integrationTestImplementation 'com.github.g3force:configurable:3.0'
integrationTestImplementation 'org.apache.logging.log4j:log4j-api:2.17.1'
integrationTestRuntimeOnly 'org.apache.logging.log4j:log4j-core:2.17.1'
integrationTestRuntimeOnly 'org.apache.logging.log4j:log4j-1.2-api:2.17.1'
integrationTestRuntimeOnly 'org.slf4j:slf4j-log4j12:1.7.33'
integrationTestRuntimeOnly 'org.slf4j:slf4j-log4j12:1.7.36'
integrationTestAnnotationProcessor "org.projectlombok:lombok:1.18.22"
integrationTestImplementation "org.projectlombok:lombok:1.18.22"
......@@ -78,8 +79,3 @@ task integrationTest(type: Test) {
// inspired by: https://blog.gradle.org/stop-rerunning-tests
inputs.property "integration.date", System.currentTimeSeconds()
}
analyzeIntegrationTestClassesDependencies {
// Set to false until up-to-date check works again (bug in plugin)
logDependencyInformationToFiles = false
}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%d %p [%t|%c{1}] %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="all">
<AppenderRef ref="CONSOLE"/>
</Root>
</Loggers>
</Configuration>
......@@ -3,7 +3,7 @@
*/
plugins {
id 'sumatra.java-conventions'
id 'sumatra.java'
id 'java-library'
}
......
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%d %p [%t|%c{1}] %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="all">
<AppenderRef ref="CONSOLE"/>
</Root>
</Loggers>
</Configuration>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment