Skip to content

Commit

Permalink
Merge branch 'master' into feat/princess-commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Scoppio authored Feb 26, 2025
2 parents be6d791 + 655e8cf commit 39431d7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions megamek/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,16 @@ jacocoTestReport {
}
}

// Test task including GUI tests
task testWithGUITests(type: Test) {
useJUnitPlatform()
jvmArgs = mmJvmOptions
environment 'GUITests', "true"

group 'verification'
description 'Sets environment var to include GUI unit tests; no report generated.'
}

// These are utility classes for all of the classes with the src/utilities folder.

task officialUnitList(type: JavaExec, dependsOn: jar) {
Expand Down
9 changes: 9 additions & 0 deletions megamek/unittests/megamek/logging/MMLoggerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import org.apache.logging.log4j.spi.AbstractLogger;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
import org.mockito.ArgumentCaptor;
import org.mockito.MockitoAnnotations;

Expand Down Expand Up @@ -83,6 +85,7 @@ public void testDebugLoggingWithException() {
verifyLog(Level.DEBUG, "Debug message: test", e);
}

@EnabledIfEnvironmentVariable(named = "GUITests", matches = "true")
@Test
public void testErrorLogging() {
if (GraphicsEnvironment.isHeadless()) {
Expand All @@ -94,6 +97,7 @@ public void testErrorLogging() {
verifyLog(Level.ERROR, "Error message: test");
}

@EnabledIfEnvironmentVariable(named = "GUITests", matches = "true")
@Test
public void testErrorLoggingWithStringFormat() {
if (GraphicsEnvironment.isHeadless()) {
Expand All @@ -105,6 +109,7 @@ public void testErrorLoggingWithStringFormat() {
verifyLog(Level.ERROR, "Error message: test");
}

@EnabledIfEnvironmentVariable(named = "GUITests", matches = "true")
@Test
public void testDeprecatedErrorLoggingWithExceptionNoParams() {
if (GraphicsEnvironment.isHeadless()) {
Expand All @@ -117,6 +122,7 @@ public void testDeprecatedErrorLoggingWithExceptionNoParams() {
verifyLog(Level.ERROR, "Error message: noparameter accepted", e);
}

@EnabledIfEnvironmentVariable(named = "GUITests", matches = "true")
@Test
public void testErrorLoggingWithException() {
if (GraphicsEnvironment.isHeadless()) {
Expand All @@ -135,6 +141,7 @@ public void testFatalLogging() {
verifyLog(Level.FATAL, "Fatal without dialog without exception");
}

@EnabledIfEnvironmentVariable(named = "GUITests", matches = "true")
@Test
public void testFatalLoggingWithDialog() {
if (GraphicsEnvironment.isHeadless()) {
Expand All @@ -146,6 +153,7 @@ public void testFatalLoggingWithDialog() {
verifyLog(Level.FATAL, "Fatal with dialog with exception");
}

@EnabledIfEnvironmentVariable(named = "GUITests", matches = "true")
@Test
public void testDeprecatedFatalLoggingWithDialog() {
if (GraphicsEnvironment.isHeadless()) {
Expand All @@ -164,6 +172,7 @@ public void testFatalLoggingWithException() {
verifyLog(Level.FATAL, "Fatal without dialog with exception", e);
}

@EnabledIfEnvironmentVariable(named = "GUITests", matches = "true")
@Test
public void testDeprecatedFatalLoggingWithException() {
if (GraphicsEnvironment.isHeadless()) {
Expand Down

0 comments on commit 39431d7

Please sign in to comment.