Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
/ jfx11u Public archive

Commit

Permalink
8274274: Update JUnit to version 5.8.1
Browse files Browse the repository at this point in the history
Reviewed-by: arapte
Backport-of: ff6e8d50badd57549811391b1380707bb94ac55b
  • Loading branch information
kevinrushforth committed May 2, 2022
1 parent e877f30 commit 44e691e
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 5 deletions.
18 changes: 14 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -1854,7 +1854,18 @@ allprojects {
// By default all of our projects require junit for testing so we can just
// setup this dependency here.
dependencies {
testImplementation group: "junit", name: "junit", version: "4.8.2"
testImplementation group: "junit", name: "junit", version: "4.13.2"
testImplementation group: "org.hamcrest", name: "hamcrest-core", version: "1.3"
testImplementation group: "org.junit.jupiter", name: "junit-jupiter", version: "5.8.1"
testImplementation group: "org.junit.jupiter", name: "junit-jupiter-api", version: "5.8.1"
testRuntimeOnly group: "org.apiguardian", name: "apiguardian-api", version: "1.1.2"
testRuntimeOnly group: "org.junit.jupiter", name: "junit-jupiter-engine", version: "5.8.1"
testRuntimeOnly group: "org.junit.jupiter", name: "junit-jupiter-params", version: "5.8.1"
testRuntimeOnly group: "org.junit.platform", name: "junit-platform-commons", version: "1.8.1"
testRuntimeOnly group: "org.junit.platform", name: "junit-platform-engine", version: "1.8.1"
testRuntimeOnly group: "org.junit.vintage", name: "junit-vintage-engine", version: "5.8.1"
testRuntimeOnly group: "org.opentest4j", name: "opentest4j", version: "1.2.0"

if (BUILD_CLOSED && DO_JCOV) {
testImplementation name: "jcov"
}
Expand All @@ -1869,6 +1880,8 @@ allprojects {
// Java 7 but when we switch to 8 this will be needed, and probably again when
// we start building with Java 9.
test {
useJUnitPlatform();

executable = JAVA;
enableAssertions = true;
testLogging.exceptionFormat = "full";
Expand Down Expand Up @@ -1953,7 +1966,6 @@ project(":base") {
}

dependencies {
testImplementation group: "junit", name: "junit", version: "4.8.2"
testImplementation sourceSets.main.output
testImplementation sourceSets.shims.output
}
Expand Down Expand Up @@ -2029,8 +2041,6 @@ project(":graphics") {
}

dependencies {
stubImplementation group: "junit", name: "junit", version: "4.8.2"

antlr group: "org.antlr", name: "antlr4", version: "4.7.2", classifier: "complete"
implementation project(':base')
}
Expand Down
3 changes: 2 additions & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ repositories {
}

dependencies {
testImplementation group: "junit", name: "junit", version: "4.8.2"
testImplementation group: "junit", name: "junit", version: "4.13.2"
testImplementation group: "org.hamcrest", name: "hamcrest-core", version: "1.3"
}

// At the moment the ASM library shipped with Gradle that is used to
Expand Down
5 changes: 5 additions & 0 deletions modules/javafx.base/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5">
<attributes>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
Expand Down
39 changes: 39 additions & 0 deletions modules/javafx.base/src/test/java/test/JUnit5Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

package test;

import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.junit.jupiter.api.Test;

public class JUnit5Test {

@Test
void junit5ShouldWork() {
System.err.println("JUnit 5 test working!");
assertNotNull(this);
}
}

1 comment on commit 44e691e

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.