fixed bug in CourseImpl where deleting the last waypoint caused an exception while trying to delete non-existing leg

This commit is contained in:
Axel Uhl
2011-11-21 13:47:50 +01:00
parent 37d3f2d8ea
commit f360f8db3f
2 changed files with 24 additions and 6 deletions
@@ -1,12 +1,13 @@
package diffutils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import junit.framework.TestCase;
import difflib.DiffUtils;
import difflib.Patch;
import difflib.PatchFailedException;
import junit.framework.TestCase;
import java.util.Arrays;
import java.util.List;
public class PatchTest extends TestCase {
@@ -45,4 +46,19 @@ public class PatchTest extends TestCase {
fail(e.getMessage());
}
}
public void testPatch_EntirelyDifferent() {
final List<String> changeTest_from = new ArrayList<String>();
changeTest_from.add("aaa");
changeTest_from.add("bbb");
final List<String> changeTest_to = Arrays.asList("ccc", "ddd");
final Patch<String> patch = DiffUtils.diff(changeTest_from, changeTest_to);
try {
patch.applyToInPlace(changeTest_from);
assertEquals(changeTest_to, changeTest_from);
} catch (PatchFailedException e) {
fail(e.getMessage());
}
}
}