Changeset 12842 in josm for trunk/test/unit/org/openstreetmap/josm/gui/io/CustomConfiguratorTest.java
- Timestamp:
- 2017-09-13T16:32:24+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/io/CustomConfiguratorTest.java
r12826 r12842 44 44 File tmp = File.createTempFile("josm.testExportPreferencesKeysToFile.lorem_ipsum", ".xml"); 45 45 46 Main.pref.put Collection("lorem_ipsum", Arrays.asList(46 Main.pref.putList("lorem_ipsum", Arrays.asList( 47 47 "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", 48 48 "Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.", … … 57 57 String xml = Utils.join("\n", Files.readAllLines(tmp.toPath(), StandardCharsets.UTF_8)); 58 58 assertTrue(xml.contains("<preferences operation=\"replace\">")); 59 for (String entry : Main.pref.get Collection("lorem_ipsum")) {59 for (String entry : Main.pref.getList("lorem_ipsum")) { 60 60 assertTrue(entry + "\nnot found in:\n" + xml, xml.contains(entry)); 61 61 } 62 62 63 Main.pref.put Collection("test", Arrays.asList("11111111", "2222222", "333333333"));63 Main.pref.putList("test", Arrays.asList("11111111", "2222222", "333333333")); 64 64 CustomConfigurator.exportPreferencesKeysByPatternToFile(tmp.getAbsolutePath(), true, "test"); 65 65 xml = Utils.join("\n", Files.readAllLines(tmp.toPath(), StandardCharsets.UTF_8)); 66 66 assertTrue(xml.contains("<preferences operation=\"append\">")); 67 for (String entry : Main.pref.get Collection("test")) {67 for (String entry : Main.pref.getList("test")) { 68 68 assertTrue(entry + "\nnot found in:\n" + xml, xml.contains(entry)); 69 69 } … … 79 79 public void testReadXML() throws IOException { 80 80 // Test 1 - read(dir, file) + append 81 Main.pref.put Collection("test", Collections.<String>emptyList());82 assertTrue(Main.pref.get Collection("test").isEmpty());81 Main.pref.putList("test", Collections.<String>emptyList()); 82 assertTrue(Main.pref.getList("test").isEmpty()); 83 83 CustomConfigurator.readXML(TestUtils.getTestDataRoot() + "customconfigurator", "append.xml"); 84 84 String log = PreferencesUtils.getLog(); 85 85 assertFalse(log, log.contains("Error")); 86 assertFalse(Main.pref.get Collection("test").isEmpty());86 assertFalse(Main.pref.getList("test").isEmpty()); 87 87 88 88 // Test 2 - read(file, pref) + replace … … 90 90 // avoid messing up preferences file (that makes all following unit tests fail) 91 91 pref.enableSaveOnPut(false); 92 pref.put Collection("lorem_ipsum", Arrays.asList("only 1 string"));93 assertEquals(1, pref.get Collection("lorem_ipsum").size());92 pref.putList("lorem_ipsum", Arrays.asList("only 1 string")); 93 assertEquals(1, pref.getList("lorem_ipsum").size()); 94 94 CustomConfigurator.readXML(new File(TestUtils.getTestDataRoot() + "customconfigurator", "replace.xml"), pref); 95 95 log = PreferencesUtils.getLog(); 96 96 assertFalse(log, log.contains("Error")); 97 assertEquals(9, pref.get Collection("lorem_ipsum").size());97 assertEquals(9, pref.getList("lorem_ipsum").size()); 98 98 } 99 99 }
Note:
See TracChangeset
for help on using the changeset viewer.