Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{div:class=navigation}
{table:width=100%}
 {tr}
  {td} {align:left}[Previous|Find Usages Test] {span:class=sep}\|{span} {span:class=text}Find Usages Test{span}{align} {td}
  {td} {align:center}[Top|Writing Tests for Plugins] {span:class=sep}\|{span} {span:class=text}Writing Tests for Plugins{span}{align} {td}
  {td} {align:right}[Next|Reference Test] {span:class=sep}\|{span} {span:class=text}Reference Test{span}{align} {td}
 {tr}
{table}
{div}

In this test we will check if the commenter, implemented in the previous tutorial, works as we expect.

1. Define a test method

Code Block

public void testCommenter() {
    myFixture.configureByText(SimpleFileType.INSTANCE, "<caret>website = http://en.wikipedia.org/");
    CommentByLineCommentAction commentAction = new CommentByLineCommentAction();
    commentAction.actionPerformedImpl(getProject(), myFixture.getEditor());
    myFixture.checkResult("#website = http://en.wikipedia.org/");
    commentAction.actionPerformedImpl(getProject(), myFixture.getEditor());
    myFixture.checkResult("website = http://en.wikipedia.org/");
}

2. Run the test

Run the test and make sure it's green.

Wiki Markup
{div:class=navigation}
{table:width=100%}
 {tr}
  {td} {align:left}[Previous|Find Usages Test] {span:class=sep}\|{span} {span:class=text}Find Usages Test{span}{align} {td}
  {td} {align:center}[Top|Writing Tests for Plugins] {span:class=sep}\|{span} {span:class=text}Writing Tests for Plugins{span}{align} {td}
  {td} {align:right}[Next|Reference Test] {span:class=sep}\|{span} {span:class=text}Reference Test{span}{align} {td}
 {tr}
{table}
{div}

 

Redirect
locationhttp://www.jetbrains.org/intellij/sdk/docs/tutorials/writing_tests_for_plugins/commenter_test.html