Fix off by one index error in tests.

The index should start at 0, this is just a small bug in the test that is hidden by the lack of input validation in the Editor and the current implementation of getCleanFile/getDirtyFile.
This check should be outside of the `synchronized` block. No use grabbing a lock to throw an exception.

Also, super nit pick: can you flip the order of the conditions so the less than zero check is first?