Skip to content

test: provide test case for Jakarta quick fixes - #862

Merged
angelozerr merged 1 commit into
redhat-developer:mainfrom
angelozerr:codeaction_test
Apr 7, 2025
Merged

angelozerr merged 1 commit into
redhat-developer:mainfrom
angelozerr:codeaction_test

Conversation

@angelozerr

Copy link
Copy Markdown
Contributor

test: provide test case for Jakarta quick fixes

@angelozerr
angelozerr force-pushed the codeaction_test branch 3 times, most recently from 5247678 to b4a60bf Compare February 21, 2025 16:52
@angelozerr
angelozerr marked this pull request as ready for review February 21, 2025 18:24
@angelozerr
angelozerr force-pushed the codeaction_test branch 2 times, most recently from 7f17fe8 to 7839830 Compare February 21, 2025 18:39
@angelozerr

Copy link
Copy Markdown
Contributor Author

I don't understand those test work inmy local machine but not in CI build

There are different error according the OS:

  Test testWebFilterQuickFix FAILED (1.5s)

  java.lang.AssertionError: <empty> expected:<[Add the `servletNames` attribute to @WebFilter]> but was:<[]>
      at com.redhat.devtools.lsp4ij.features.codeAction.WebFilterQuickFixTest.testWebFilterQuickFix(WebFilterQuickFixTest.java:29)

  Test testWebFilterQuickFix FAILED (1.2s)

  java.lang.AssertionError: PSI/document/model changes are not allowed during highlighting
      at com.redhat.devtools.lsp4ij.features.codeAction.WebFilterQuickFixTest.testWebFilterQuickFix(WebFilterQuickFixTest.java:29)

@SCWells72 have you some idea?

@dessina-devasia

Copy link
Copy Markdown

@angelozerr Could you please check the below log, may be it happens because of this failure

java.lang.IllegalStateException: ProblemHighlightFilter.shouldHighlightFile('PsiJavaFile:InvalidWebFilter.java') == false, so can't highlight it. Maybe it's because file://C:/Users/runneradmin/AppData/Local/Temp/unitTest_webFilterQuickFix_2tLWIcFeAlhKsObULEkJxu8aPZr/unitTest14166388982294194896/InvalidWebFilter.java is outside source folders? (source folders: [])
      at com.redhat.devtools.lsp4ij.features.codeAction.WebFilterQuickFixTest.testWebFilterQuickFix(WebFilterQuickFixTest.java:25)

The error suggests that the test is trying to highlight a file (InvalidWebFilter.java) that is not inside a recognized source folder. This is likely causing ProblemHighlightFilter.shouldHighlightFile(...) to return false, leading to the IllegalStateException

@angelozerr

Copy link
Copy Markdown
Contributor Author

Indeed I noticed this error but I have no idea how to configure that.

@angelozerr

Copy link
Copy Markdown
Contributor Author

Mmmm that is strange, I dont use *.java extension but *.javax

@angelozerr

Copy link
Copy Markdown
Contributor Author

@dessina-devasia where do you see this log trace? Are you using my test? My test uses *.javax file extension isntead of *.java.

@dessina-devasia

dessina-devasia commented Feb 25, 2025 •

Copy link
Copy Markdown

@angelozerr I found this error from my previous PR(#793), seems its similar to this one. That why I added it here.
You can refer here: https://github.com/redhat-developer/lsp4ij/actions/runs/13389306477/job/37594786192?pr=793#step:5:285

@angelozerr

Copy link
Copy Markdown
Contributor Author

@angelozerr I found this error from my previous PR(#793), seems its similar to this one. That why I added it here.
You can refer here: https://github.com/redhat-developer/lsp4ij/actions/runs/13389306477/job/37594786192?pr=793#step:5:285

Using a javax extension avoid working with a PsiJavaFile, so I think it is a different behaviour than your previous PR.

Please try my PR

@angelozerr
angelozerr force-pushed the codeaction_test branch 7 times, most recently from 62c8011 to 5e528a3 Compare February 26, 2025 14:14
@angelozerr
angelozerr force-pushed the codeaction_test branch 5 times, most recently from 8211995 to 2ccba36 Compare April 7, 2025 11:02
@angelozerr
angelozerr force-pushed the codeaction_test branch 6 times, most recently from 249d861 to a774fb8 Compare April 7, 2025 13:51
@angelozerr angelozerr self-assigned this Apr 7, 2025
@angelozerr angelozerr added this to the 0.13.0 milestone Apr 7, 2025
@angelozerr angelozerr moved this to Pending review in Java Tooling Apr 7, 2025
@angelozerr
angelozerr merged commit 79675b6 into redhat-developer:main Apr 7, 2025
@github-project-automation github-project-automation Bot moved this from Pending review to Done in Java Tooling Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants