*
* @param harness the test harness (<code>null</code> not permitted).
*/
public void test(TestHarness harness)
{
GapContent gc = new GapContent();
harness.check(gc.length(), 1);
try
{
gc.insertString(0, "ABC");
}
catch (BadLocationException e)
{
// ignore
}
// negative index
boolean pass = false;
try
{
gc.createPosition(-1);
}
catch (BadLocationException e)
{
pass = true;
}
harness.check(pass);
// index of last char
Position p = null;
try
{
p = gc.createPosition(3);
}
catch (BadLocationException e)
{
pass = true;
}
harness.check(p.getOffset(), 3);
// index of last char + 1
try
{
p = gc.createPosition(4);
}
catch (BadLocationException e)
{
}
harness.check(p.getOffset(), 4);
// index of last char + 2
pass = false;
try
{
p = gc.createPosition(5);
}
catch (BadLocationException e)
{
pass = true;
}