Skip to content

Commit

Permalink
Fix CI for 1.44.0 bump (#142)
Browse files Browse the repository at this point in the history
A test depended on the ordering of validation events, which 1.44.0 changes.
  • Loading branch information
milesziemer authored Feb 7, 2024
1 parent fea1fd7 commit b43f9c3
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/test/java/software/amazon/smithy/lsp/SmithyInterfaceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

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;
import java.nio.file.Paths;
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;
Expand Down Expand Up @@ -105,10 +105,16 @@ public void runValidators() throws Exception {
assertTrue(result.isRight());
List<ValidationEvent> 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<ValidationEvent> 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<File> getFiles(String... filenames) throws Exception {
Expand Down

0 comments on commit b43f9c3

Please sign in to comment.