mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-19 20:25:31 +00:00
fixed bug in CourseImpl where deleting the last waypoint caused an exception while trying to delete non-existing leg
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user