Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust testcase due to differing diagnostics from JEP 445. #3042

Merged
merged 1 commit into from
Feb 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1008,17 +1008,17 @@ public void testDiagnosticsOnExternalFileWithInternalProject() throws Exception
Path filePath = Files.createTempDirectory("testDiagnosticsOnExternalFileWithInternalProject").resolve("A.java");
try {
String content = "error public class A { }";
Files.writeString(filePath, content);
Files.writeString(filePath, content);
lifeCycleHandler.didOpen(new DidOpenTextDocumentParams(new TextDocumentItem(filePath.toUri().toString(), "java", 0, content)));
List<PublishDiagnosticsParams> diagnosticReports = getClientRequests("publishDiagnostics");
assertFalse("No diagnostics sent on open", diagnosticReports.isEmpty());
List<Diagnostic> diagnostics = diagnosticReports.get(0).getDiagnostics();
assertTrue("First diagnostics not sent", diagnostics.stream().map(Diagnostic::getMessage).anyMatch(message -> message.contains("error on token \"error\"")));
assertTrue("First diagnostics not sent", diagnostics.stream().map(Diagnostic::getMessage).anyMatch(message -> message.contains("Syntax error")));
lifeCycleHandler.didChange(new DidChangeTextDocumentParams(new VersionedTextDocumentIdentifier(filePath.toUri().toString(), 0), List.of(new TextDocumentContentChangeEvent(new Range(new Position(0, 0), new Position(0, 0)), "another"))));
diagnosticReports = getClientRequests("publishDiagnostics");
assertEquals("No diagnostics sent on change", 2, diagnosticReports.size());
diagnostics = diagnosticReports.get(1).getDiagnostics();
assertTrue("diagnostics not updated upon edit", diagnostics.stream().map(Diagnostic::getMessage).anyMatch(message -> message.contains("error on token \"anothererror\"")));
assertTrue("diagnostics not updated upon edit", diagnostics.stream().map(Diagnostic::getMessage).anyMatch(message -> message.contains("Syntax error")));
} finally {
Files.delete(filePath);
Files.delete(filePath.getParent());
Expand Down
Loading