From b43f9c3d057abb7d81a62807c7b10fb5b157f00c Mon Sep 17 00:00:00 2001 From: Miles Ziemer <45497130+milesziemer@users.noreply.github.com> Date: Wed, 7 Feb 2024 16:01:29 -0500 Subject: [PATCH] Fix CI for 1.44.0 bump (#142) A test depended on the ordering of validation events, which 1.44.0 changes. --- .../amazon/smithy/lsp/SmithyInterfaceTest.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/test/java/software/amazon/smithy/lsp/SmithyInterfaceTest.java b/src/test/java/software/amazon/smithy/lsp/SmithyInterfaceTest.java index 9db0e0d3..77fd2945 100644 --- a/src/test/java/software/amazon/smithy/lsp/SmithyInterfaceTest.java +++ b/src/test/java/software/amazon/smithy/lsp/SmithyInterfaceTest.java @@ -17,7 +17,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertEquals; import java.io.File; import java.nio.file.Path; @@ -25,6 +24,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import org.eclipse.lsp4j.jsonrpc.messages.Either; import org.junit.Test; @@ -105,10 +105,16 @@ public void runValidators() throws Exception { assertTrue(result.isRight()); List validationEvents = result.getRight().getValidationEvents(); assertFalse(validationEvents.isEmpty()); - assertEquals( - "Proto index 1 is used muliple times in members name,age of shape (structure: `some.test#MyStruct`).", - validationEvents.get(0).getMessage() - ); + + String expectedMessage = "Proto index 1 is used muliple times in members name," + + "age of shape (structure: `some.test#MyStruct`)."; + Optional matchingEvent = validationEvents.stream() + .filter(ev ->ev.getMessage().equals(expectedMessage)).findFirst(); + + if (!matchingEvent.isPresent()) { + throw new AssertionError("Expected validation event with message `" + expectedMessage + + "`, but events were " + validationEvents); + } } private static List getFiles(String... filenames) throws Exception {