mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-03 19:03:52 +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 parent
37d3f2d8ea
commit
f360f8db3f
2 files changed
+24
-6
No files matched your search
@@ -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