Create the simplest test case
The first test case for the checker should be as simple as possible. As the checker is developed more complex cases can be added and tested.
Example: Assignment instead of '+=' operator in an expression.
It's easy to mistype the '+=' operator in the expression 'a += 5' as an assignment operator: 'a =+ 5' ('=+' instead of '+='). This error still results in valid Java code.
Here is a very simple code fragment that will generate a Klocwork issue for this error:
class Testcase { public void method() { int x = 2; int j = x =+5; //Error: assignment instead of += } }
Add this code to the checker's test case file (KASTJ.MYCHECKER/Testcase.java
).