-
Notifications
You must be signed in to change notification settings - Fork 802
Maintenance: Test infrastructure - Refactor configureByJavaText helper #1374
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,17 @@ | |
|
|
||
| package org.jetbrains.plugins.ideavim | ||
|
|
||
| import com.intellij.ide.highlighter.JavaFileType | ||
|
|
||
| abstract class VimJavaTestCase : VimTestCase() { | ||
| protected fun configureByJavaText(content: String) = configureByText(JavaFileType.INSTANCE, content) | ||
| } | ||
| /** | ||
| * Base test case for tests that require Java file type support. | ||
| * | ||
| * This class extends [VimTestCase] and is specifically designed for tests that need to work with | ||
| * Java source files, where language-specific features like auto-indentation, code folding, or | ||
| * syntax-aware operations are required. | ||
| * | ||
| * Tests can use the inherited [configureByJavaText] method from [VimTestCase] to set up Java files. | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ Excellent documentation: The KDoc is comprehensive and clearly explains:
Suggestion: Consider adding a |
||
| * This class serves as a semantic marker and provides a convenient base for Java-specific test setup | ||
| * if needed in the future. | ||
| * | ||
| * @see VimTestCase | ||
| */ | ||
| abstract class VimJavaTestCase : VimTestCase() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,6 @@ | |
|
|
||
| package org.jetbrains.plugins.ideavim.propertybased | ||
|
|
||
| import com.intellij.ide.highlighter.JavaFileType | ||
| import com.intellij.openapi.application.ApplicationManager | ||
| import com.intellij.openapi.editor.Editor | ||
| import com.maddyhome.idea.vim.KeyHandler | ||
|
|
@@ -40,6 +39,4 @@ abstract class VimPropertyTestBase : VimTestCase() { | |
| VimPlugin.getSearch().resetState() | ||
| VimPlugin.getChange().reset() | ||
| } | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ Clean refactoring: The removal of the duplicate All 4 subclasses of
|
||
|
|
||
| protected fun configureByJavaText(content: String) = configureByText(JavaFileType.INSTANCE, content) | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Good placement and consistency: This helper method is now properly aligned with the existing
configureByXmlTextmethod, following the established pattern in the codebase. The refactoring successfully eliminates duplication.Minor note: The method returns
Editor(inherited from the baseconfigureByTextmethod), which is consistent with the original implementations and maintains backward compatibility.