Ignore:
Timestamp:
2021-03-15T13:53:05+01:00 (9 months ago)
Author:
Don-vip
Message:

fix #20594 - add robustness to AutomaticCombine when Integer values cannot be parsed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolutionUtilTest.java

    r17275 r17564  
    55import static org.junit.jupiter.api.Assertions.assertFalse;
    66import static org.junit.jupiter.api.Assertions.assertNull;
     7import static org.junit.jupiter.api.Assertions.assertThrows;
    78import static org.junit.jupiter.api.Assertions.assertTrue;
    8 import static org.junit.jupiter.api.Assertions.assertThrows;
    99
    1010import java.util.Arrays;
     
    213213        void testResolve() {
    214214            for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("random", "", true, "|", "String"))) {
    215                 assertEquals(resolver.resolve(newHashSet("value1", "value2")), "value1|value2");
    216                 assertEquals(resolver.resolve(newHashSet("3|1", "4|2|1", "6|05", "3;1")), "05|1|2|3|3;1|4|6");
     215                assertEquals("value1|value2", resolver.resolve(newHashSet("value1", "value2")));
     216                assertEquals("05|1|2|3|3;1|4|6", resolver.resolve(newHashSet("3|1", "4|2|1", "6|05", "3;1")));
    217217            }
    218218
    219219            for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("test[45].*", "", true, ";", "Integer"))) {
    220                 assertEquals(resolver.resolve(newHashSet("1254545;95;24", "25;24;3")), "3;24;25;95;1254545");
     220                assertEquals("3;24;25;95;1254545", resolver.resolve(newHashSet("1254545;95;24", "25;24;3")));
    221221            }
    222222
     
    224224                String resolution = resolver.resolve(newHashSet("3;x;1", "4;x"));
    225225                assertTrue(resolution.equals("3;x;1;4") || resolution.equals("4;x;3;1"));
     226            }
     227
     228            for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("foo", "", true, ";", "Integer"))) {
     229                assertEquals("bar;1;2;3", resolver.resolve(newHashSet("1;2;3", "bar")));
    226230            }
    227231        }
Note: See TracChangeset for help on using the changeset viewer.