How to test HighlightVisitor?

How to add test for HightloghtVisitor implementation? thanks!

0
3 comments
Avatar
Permanently deleted user

Easy.

<code>

void testMyHighlighter() {

  assertEquals(4, new MyHighlightVisitor().computeTwoPlusTwo());

}

</code>

(you can also see 

http://www.jetbrains.org/intellij/sdk/docs/basics/testing_plugins.html )
0
Avatar
Permanently deleted user

I mean, there are some code:

public class Test {
public Boolean test() {
return "true".equals("false");
}
}

 

And I have a `HighlightVisitor`, now I am trying to test my `HighlightVisitor`, so I think that I need a text which contains the code I want to highlight and a editor (maybe?), and use my `HighlightVisitor` to highlight the editor and return the highlight result so that I could assert the result.

0
Avatar
Permanently deleted user

Already got it, by

myFixture.configureByText("dummy.java", code)
PsiDocumentManager.getInstance(project).commitAllDocuments()
val doHighlighting = myFixture.doHighlighting()

Thanks

0

Please sign in to leave a comment.