Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ repository on GitHub.
[[v6.2.0-M1-junit-jupiter-new-features-and-improvements]]
==== New Features and Improvements

* Added `OS.NETBSD` and `OS.DRAGONFLYBSD` enum constants for use with `@EnabledOnOs`
and `@DisabledOnOs`.
* Failures caused by `@Timeout` expirations now include a hint about enabling
xref:writing-tests/timeouts.adoc#debugging-thread-dump[thread dumps].

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
*
* @since 5.1
* @see #AIX
* @see #DRAGONFLYBSD
* @see #FREEBSD
* @see #LINUX
* @see #MAC
* @see #NETBSD
* @see #OPENBSD
* @see #SOLARIS
* @see #WINDOWS
Expand All @@ -51,6 +53,14 @@ public enum OS {
@API(status = STABLE, since = "5.3")
AIX,

/**
* DragonFly BSD operating system.
*
* @since 6.2
*/
@API(status = STABLE, since = "6.2")
DRAGONFLYBSD,

/**
* FreeBSD operating system.
*
Expand All @@ -69,6 +79,14 @@ public enum OS {
*/
MAC,

/**
* NetBSD operating system.
*
* @since 6.2
*/
@API(status = STABLE, since = "6.2")
NETBSD,

/**
* OpenBSD operating system.
*
Expand All @@ -88,8 +106,9 @@ public enum OS {
WINDOWS,

/**
* An operating system other than {@link #AIX}, {@link #FREEBSD}, {@link #LINUX},
* {@link #MAC}, {@link #OPENBSD}, {@link #SOLARIS}, or {@link #WINDOWS}.
* An operating system other than {@link #AIX}, {@link #DRAGONFLYBSD},
* {@link #FREEBSD}, {@link #LINUX}, {@link #MAC}, {@link #NETBSD},
* {@link #OPENBSD}, {@link #SOLARIS}, or {@link #WINDOWS}.
*/
OTHER;

Expand Down Expand Up @@ -125,6 +144,9 @@ public enum OS {
if (osName.contains("aix")) {
return AIX;
}
if (osName.contains("dragonflybsd")) {
return DRAGONFLYBSD;
}
if (osName.contains("freebsd")) {
return FREEBSD;
}
Expand All @@ -134,6 +156,9 @@ public enum OS {
if (osName.contains("mac")) {
return MAC;
}
if (osName.contains("netbsd")) {
return NETBSD;
}
if (osName.contains("openbsd")) {
return OPENBSD;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@

import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onAix;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onArchitecture;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onDragonflybsd;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onFreebsd;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onLinux;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onMac;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onNetbsd;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onOpenbsd;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onSolaris;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onWindows;
Expand Down Expand Up @@ -84,6 +86,15 @@ void aix() {
assertDisabledOnCurrentOsIf(onAix());
}

/**
* @see DisabledOnOsIntegrationTests#dragonflybsd()
*/
@Test
void dragonflybsd() {
evaluateCondition();
assertDisabledOnCurrentOsIf(onDragonflybsd());
}

/**
* @see DisabledOnOsIntegrationTests#freebsd()
*/
Expand Down Expand Up @@ -129,6 +140,15 @@ void openbsd() {
assertDisabledOnCurrentOsIf(onOpenbsd());
}

/**
* @see DisabledOnOsIntegrationTests#netbsd()
*/
@Test
void netbsd() {
evaluateCondition();
assertDisabledOnCurrentOsIf(onNetbsd());
}

/**
* @see DisabledOnOsIntegrationTests#windows()
*/
Expand All @@ -153,8 +173,8 @@ void solaris() {
@Test
void other() {
evaluateCondition();
assertDisabledOnCurrentOsIf(
!(onAix() || onFreebsd() || onLinux() || onMac() || onOpenbsd() || onSolaris() || onWindows()));
assertDisabledOnCurrentOsIf(!(onAix() || onDragonflybsd() || onFreebsd() || onLinux() || onMac() || onNetbsd()
|| onOpenbsd() || onSolaris() || onWindows()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onAix;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onArchitecture;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onDragonflybsd;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onFreebsd;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onLinux;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onMac;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onNetbsd;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onOpenbsd;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onSolaris;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onWindows;
import static org.junit.jupiter.api.condition.OS.AIX;
import static org.junit.jupiter.api.condition.OS.DRAGONFLYBSD;
import static org.junit.jupiter.api.condition.OS.FREEBSD;
import static org.junit.jupiter.api.condition.OS.LINUX;
import static org.junit.jupiter.api.condition.OS.MAC;
import static org.junit.jupiter.api.condition.OS.NETBSD;
import static org.junit.jupiter.api.condition.OS.OPENBSD;
import static org.junit.jupiter.api.condition.OS.OTHER;
import static org.junit.jupiter.api.condition.OS.SOLARIS;
Expand Down Expand Up @@ -57,7 +61,7 @@ void missingOsAndArchitectureDeclaration() {
}

@Test
@DisabledOnOs(value = { AIX, FREEBSD, LINUX, MAC, OPENBSD, WINDOWS, SOLARIS,
@DisabledOnOs(value = { AIX, DRAGONFLYBSD, FREEBSD, LINUX, MAC, NETBSD, OPENBSD, WINDOWS, SOLARIS,
OTHER }, disabledReason = "Disabled on every OS")
void disabledOnEveryOs() {
fail("should be disabled");
Expand All @@ -69,6 +73,12 @@ void aix() {
assertFalse(onAix());
}

@Test
@DisabledOnOs(DRAGONFLYBSD)
void dragonflybsd() {
assertFalse(onDragonflybsd());
}

@Test
@DisabledOnOs(FREEBSD)
void freebsd() {
Expand Down Expand Up @@ -99,6 +109,12 @@ void openbsd() {
assertFalse(onOpenbsd());
}

@Test
@DisabledOnOs(NETBSD)
void netbsd() {
assertFalse(onNetbsd());
}

@Test
@DisabledOnOs(WINDOWS)
void windows() {
Expand All @@ -114,7 +130,8 @@ void solaris() {
@Test
@DisabledOnOs(OTHER)
void other() {
assertTrue(onAix() || onFreebsd() || onLinux() || onMac() || onOpenbsd() || onSolaris() || onWindows());
assertTrue(onAix() || onDragonflybsd() || onFreebsd() || onLinux() || onMac() || onNetbsd() || onOpenbsd()
|| onSolaris() || onWindows());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@

import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onAix;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onArchitecture;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onDragonflybsd;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onFreebsd;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onLinux;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onMac;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onNetbsd;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onOpenbsd;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onSolaris;
import static org.junit.jupiter.api.condition.EnabledOnOsIntegrationTests.onWindows;
Expand Down Expand Up @@ -83,6 +85,15 @@ void aix() {
assertEnabledOnCurrentOsIf(onAix());
}

/**
* @see EnabledOnOsIntegrationTests#dragonflybsd()
*/
@Test
void dragonflybsd() {
evaluateCondition();
assertEnabledOnCurrentOsIf(onDragonflybsd());
}

/**
* @see EnabledOnOsIntegrationTests#freebsd()
*/
Expand Down Expand Up @@ -128,6 +139,15 @@ void openbsd() {
assertEnabledOnCurrentOsIf(onOpenbsd());
}

/**
* @see EnabledOnOsIntegrationTests#netbsd()
*/
@Test
void netbsd() {
evaluateCondition();
assertEnabledOnCurrentOsIf(onNetbsd());
}

/**
* @see EnabledOnOsIntegrationTests#windows()
*/
Expand All @@ -152,8 +172,8 @@ void solaris() {
@Test
void other() {
evaluateCondition();
assertEnabledOnCurrentOsIf(
!(onAix() || onFreebsd() || onLinux() || onMac() || onOpenbsd() || onSolaris() || onWindows()));
assertEnabledOnCurrentOsIf(!(onAix() || onDragonflybsd() || onFreebsd() || onLinux() || onMac() || onNetbsd()
|| onOpenbsd() || onSolaris() || onWindows()));
assertCustomDisabledReasonIs("Disabled on almost every OS");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.condition.OS.AIX;
import static org.junit.jupiter.api.condition.OS.DRAGONFLYBSD;
import static org.junit.jupiter.api.condition.OS.FREEBSD;
import static org.junit.jupiter.api.condition.OS.LINUX;
import static org.junit.jupiter.api.condition.OS.MAC;
import static org.junit.jupiter.api.condition.OS.NETBSD;
import static org.junit.jupiter.api.condition.OS.OPENBSD;
import static org.junit.jupiter.api.condition.OS.OTHER;
import static org.junit.jupiter.api.condition.OS.SOLARIS;
Expand Down Expand Up @@ -52,7 +54,7 @@ void missingOsAndArchitectureDeclaration() {
}

@Test
@EnabledOnOs({ AIX, FREEBSD, LINUX, MAC, OPENBSD, WINDOWS, SOLARIS, OTHER })
@EnabledOnOs({ AIX, DRAGONFLYBSD, FREEBSD, LINUX, MAC, NETBSD, OPENBSD, WINDOWS, SOLARIS, OTHER })
void enabledOnEveryOs() {
}

Expand All @@ -62,6 +64,12 @@ void aix() {
assertTrue(onAix());
}

@Test
@EnabledOnOs(DRAGONFLYBSD)
void dragonflybsd() {
assertTrue(onDragonflybsd());
}

@Test
@EnabledOnOs(FREEBSD)
void freebsd() {
Expand Down Expand Up @@ -92,6 +100,12 @@ void openbsd() {
assertTrue(onOpenbsd());
}

@Test
@EnabledOnOs(NETBSD)
void netbsd() {
assertTrue(onNetbsd());
}

@Test
@EnabledOnOs(WINDOWS)
void windows() {
Expand All @@ -107,7 +121,8 @@ void solaris() {
@Test
@EnabledOnOs(value = OTHER, disabledReason = "Disabled on almost every OS")
void other() {
assertFalse(onAix() || onFreebsd() || onLinux() || onMac() || onOpenbsd() || onSolaris() || onWindows());
assertFalse(onAix() || onDragonflybsd() || onFreebsd() || onLinux() || onMac() || onNetbsd() || onOpenbsd()
|| onSolaris() || onWindows());
}

@Test
Expand Down Expand Up @@ -168,6 +183,10 @@ static boolean onAix() {
return OS_NAME.contains("aix");
}

static boolean onDragonflybsd() {
return OS_NAME.contains("dragonflybsd");
}

static boolean onArchitecture(String arch) {
return ARCH.contains(arch);
}
Expand All @@ -184,6 +203,10 @@ static boolean onMac() {
return OS_NAME.contains("mac");
}

static boolean onNetbsd() {
return OS_NAME.contains("netbsd");
}

static boolean onOpenbsd() {
return OS_NAME.contains("openbsd");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ void aix(String name) {
assertEquals(OS.AIX, OS.parse(name));
}

@ParameterizedTest
@ValueSource(strings = { "DRAGONFLYBSD", "DragonFlyBSD" })
void dragonflybsd(String name) {
assertEquals(OS.DRAGONFLYBSD, OS.parse(name));
}

@ParameterizedTest
@ValueSource(strings = { "FREEBSD", "FreeBSD" })
void freebsd(String name) {
Expand All @@ -65,6 +71,12 @@ void openbsd(String name) {
assertEquals(OS.OPENBSD, OS.parse(name));
}

@ParameterizedTest
@ValueSource(strings = { "NETBSD", "NetBSD" })
void netbsd(String name) {
assertEquals(OS.NETBSD, OS.parse(name));
}

@ParameterizedTest
@ValueSource(strings = { "SOLARIS", "SunOS" })
void solaris(String name) {
Expand Down
Loading