Ignore:
Timestamp:
2017-09-13T16:32:24+02:00 (7 years ago)
Author:
bastiK
Message:

see #15229 - fix test deprecations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/io/CustomConfiguratorTest.java

    r12826 r12842  
    4444        File tmp = File.createTempFile("josm.testExportPreferencesKeysToFile.lorem_ipsum", ".xml");
    4545
    46         Main.pref.putCollection("lorem_ipsum", Arrays.asList(
     46        Main.pref.putList("lorem_ipsum", Arrays.asList(
    4747                "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
    4848                "Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.",
     
    5757        String xml = Utils.join("\n", Files.readAllLines(tmp.toPath(), StandardCharsets.UTF_8));
    5858        assertTrue(xml.contains("<preferences operation=\"replace\">"));
    59         for (String entry : Main.pref.getCollection("lorem_ipsum")) {
     59        for (String entry : Main.pref.getList("lorem_ipsum")) {
    6060            assertTrue(entry + "\nnot found in:\n" + xml, xml.contains(entry));
    6161        }
    6262
    63         Main.pref.putCollection("test", Arrays.asList("11111111", "2222222", "333333333"));
     63        Main.pref.putList("test", Arrays.asList("11111111", "2222222", "333333333"));
    6464        CustomConfigurator.exportPreferencesKeysByPatternToFile(tmp.getAbsolutePath(), true, "test");
    6565        xml = Utils.join("\n", Files.readAllLines(tmp.toPath(), StandardCharsets.UTF_8));
    6666        assertTrue(xml.contains("<preferences operation=\"append\">"));
    67         for (String entry : Main.pref.getCollection("test")) {
     67        for (String entry : Main.pref.getList("test")) {
    6868            assertTrue(entry + "\nnot found in:\n" + xml, xml.contains(entry));
    6969        }
     
    7979    public void testReadXML() throws IOException {
    8080        // Test 1 - read(dir, file) + append
    81         Main.pref.putCollection("test", Collections.<String>emptyList());
    82         assertTrue(Main.pref.getCollection("test").isEmpty());
     81        Main.pref.putList("test", Collections.<String>emptyList());
     82        assertTrue(Main.pref.getList("test").isEmpty());
    8383        CustomConfigurator.readXML(TestUtils.getTestDataRoot() + "customconfigurator", "append.xml");
    8484        String log = PreferencesUtils.getLog();
    8585        assertFalse(log, log.contains("Error"));
    86         assertFalse(Main.pref.getCollection("test").isEmpty());
     86        assertFalse(Main.pref.getList("test").isEmpty());
    8787
    8888        // Test 2 - read(file, pref) + replace
     
    9090        // avoid messing up preferences file (that makes all following unit tests fail)
    9191        pref.enableSaveOnPut(false);
    92         pref.putCollection("lorem_ipsum", Arrays.asList("only 1 string"));
    93         assertEquals(1, pref.getCollection("lorem_ipsum").size());
     92        pref.putList("lorem_ipsum", Arrays.asList("only 1 string"));
     93        assertEquals(1, pref.getList("lorem_ipsum").size());
    9494        CustomConfigurator.readXML(new File(TestUtils.getTestDataRoot() + "customconfigurator", "replace.xml"), pref);
    9595        log = PreferencesUtils.getLog();
    9696        assertFalse(log, log.contains("Error"));
    97         assertEquals(9, pref.getCollection("lorem_ipsum").size());
     97        assertEquals(9, pref.getList("lorem_ipsum").size());
    9898    }
    9999}
Note: See TracChangeset for help on using the changeset viewer.