Changeset 9524 in josm for trunk/test/unit
- Timestamp:
- 2016-01-18T01:46:48+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/CustomConfiguratorTest.java
r9498 r9524 3 3 4 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertFalse; 5 6 import static org.junit.Assert.assertTrue; 6 7 … … 10 11 import java.nio.file.Files; 11 12 import java.util.Arrays; 13 import java.util.Collections; 12 14 15 import org.junit.Before; 13 16 import org.junit.BeforeClass; 14 17 import org.junit.Test; 15 18 import org.openstreetmap.josm.JOSMFixture; 16 19 import org.openstreetmap.josm.Main; 20 import org.openstreetmap.josm.TestUtils; 17 21 import org.openstreetmap.josm.tools.Utils; 18 22 … … 26 30 */ 27 31 @BeforeClass 28 public static void setUp () {32 public static void setUpBeforeClass() { 29 33 JOSMFixture.createUnitTestFixture().init(); 34 } 35 36 /** 37 * Setup test. 38 */ 39 @Before 40 public void setUp() { 41 CustomConfigurator.resetLog(); 30 42 } 31 43 … … 79 91 Utils.deleteFile(tmp); 80 92 } 93 94 /** 95 * Test method for {@link CustomConfigurator#readXML}. 96 * @throws IOException if any I/O error occurs 97 */ 98 @Test 99 public void testReadXML() throws IOException { 100 // Test 1 - read(dir, file) + append 101 Main.pref.putCollection("test", Collections.<String>emptyList()); 102 assertTrue(Main.pref.getCollection("test").isEmpty()); 103 CustomConfigurator.readXML(TestUtils.getTestDataRoot() + "customconfigurator", "append.xml"); 104 String log = CustomConfigurator.getLog(); 105 System.out.println(log); 106 assertFalse(log.contains("Error")); 107 assertFalse(Main.pref.getCollection("test").isEmpty()); 108 109 // Test 1 - read(file, pref) + replace 110 Preferences pref = new Preferences(); 111 pref.putCollection("lorem_ipsum", Arrays.asList("only 1 string")); 112 assertEquals(1, pref.getCollection("lorem_ipsum").size()); 113 CustomConfigurator.readXML(new File(TestUtils.getTestDataRoot() + "customconfigurator", "replace.xml"), pref); 114 log = CustomConfigurator.getLog(); 115 System.out.println(log); 116 assertFalse(log.contains("Error")); 117 assertEquals(9, pref.getCollection("lorem_ipsum").size()); 118 } 81 119 }
Note:
See TracChangeset
for help on using the changeset viewer.