Skip to content

Commit

Permalink
Exception message is inconsistent, which makes the test to fail somet…
Browse files Browse the repository at this point in the history
…imes.

Decided to test if the message end as expected instead.
  • Loading branch information
mvanaken committed Feb 7, 2024
1 parent 36769b6 commit 1584c81
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import static io.parsingdata.metal.util.ParseStateFactory.stream;
import static io.parsingdata.metal.util.TokenDefinitions.any;
Expand Down Expand Up @@ -47,7 +48,9 @@ public void seqTest() throws IllegalAccessException, NoSuchFieldException {
setFinalFieldAndAssert(seq, "tokens", new ParallelImmutableList<>(seq.tokens), () -> {
final Environment environment = new Environment(stream(1, 2, 3), Encoding.DEFAULT_ENCODING);
final Exception e = assertThrows(UnsupportedOperationException.class, () -> seq.parseImpl(environment));
assertEquals("Parallel processing of streams is not implemented.", e.getMessage());
final String actual = e.getMessage();
final String expected = "Parallel processing of streams is not implemented.";
assertTrue(actual.endsWith(expected), "Unexpected ending of message. Got:\n" + actual + "\nbut expected to end with:\n" + expected);
});
}

Expand Down

0 comments on commit 1584c81

Please sign in to comment.