intellij-sdk-code-samples/annotator_test.md
2015-03-24 10:42:51 +01:00

47 lines
992 B
Markdown

---
title: Annotator Test
---
<!--
INITIAL_SOURCE https://confluence.jetbrains.com/display/IntelliJIDEA/Annotator+Test
-->
# {{ page.title }}
In this test we will check if the annotator, implemented in the
[Annotator](annotator.html) section
of the
[Custom Language Support Tutorial](cls_tutorial.html)
works as we expect.
### 1. Define test data
Create a file *AnnotatorTestData.java*.
```java
public class Test {
public static void main(String[] args) {
System.out.println("simple:website");
System.out.println("simple:<error descr="Unresolved property">websit"</error>);
}
}
```
### 2. Define a test method
```java
public void testAnnotator() {
myFixture.configureByFiles("AnnotatorTestData.java", "DefaultTestData.simple");
myFixture.checkHighlighting(false, false, true);
}
```
### 3. Run the test
Run the test and make sure it's green.
-----
[Previous](completion_test.html) [Top](writing_tests_for_plugins.html) [Next](formatter_test.html)