1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-23 03:19:06 +00:00

Merge pull request #651 from matthew16550/test-failure

Prevent intermittent test failure due to PSystemError creating different output at different times of the hour
This commit is contained in:
arnaudroques 2021-09-03 10:22:40 +02:00 committed by GitHub
commit ce95fff0fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -97,6 +97,13 @@ import net.sourceforge.plantuml.version.PSystemVersion;
import net.sourceforge.plantuml.version.Version;
public abstract class PSystemError extends PlainDiagram {
// Dodgy kludge for testing - we will need a different approach if we want to test addMessageDedication() etc.
private static boolean disableTimeBasedErrorDecorations = false;
public static void disableTimeBasedErrorDecorations() {
PSystemError.disableTimeBasedErrorDecorations = true;
}
protected List<StringLocated> trace;
protected ErrorUml singleError;
@ -249,7 +256,10 @@ public abstract class PSystemError extends PlainDiagram {
}
final int min = (int) (System.currentTimeMillis() / 60000L) % 60;
// udrawable = addMessageAdopt(udrawable);
if (min == 1 || min == 8 || min == 13 || min == 55) {
if (disableTimeBasedErrorDecorations) {
// do nothing
}
else if (min == 1 || min == 8 || min == 13 || min == 55) {
udrawable = addMessagePatreon(udrawable);
} else if (min == 15) {
udrawable = addMessageLiberapay(udrawable);

View File

@ -12,6 +12,8 @@ import java.nio.charset.Charset;
import java.util.LinkedList;
import java.util.List;
import net.sourceforge.plantuml.error.PSystemError;
import org.assertj.core.api.AutoCloseableSoftAssertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -29,6 +31,8 @@ class PipeTest {
@BeforeEach
void setup() {
PSystemError.disableTimeBasedErrorDecorations();
errorStatus = ErrorStatus.init();
baos = new ByteArrayOutputStream();