Changeset 11974 in josm for trunk/test/unit
- Timestamp:
- 2017-04-22T17:57:11+02:00 (8 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java
r10378 r11974 17 17 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 18 18 import org.openstreetmap.josm.plugins.PluginDownloadTask; 19 import org.openstreetmap.josm.plugins.PluginException; 19 20 import org.openstreetmap.josm.plugins.PluginInformation; 20 21 … … 41 42 42 43 /** 44 * Returns a dummy plugin information. 45 * @return a dummy plugin information 46 * @throws PluginException if an error occurs 47 */ 48 public static PluginInformation getDummyPluginInformation() throws PluginException { 49 return new PluginInformation( 50 new File(TestUtils.getTestDataRoot() + "plugin/dummy_plugin.jar"), "dummy_plugin"); 51 } 52 53 /** 43 54 * Unit test of {@link PluginPreference#buildDownloadSummary}. 44 55 * @throws Exception if an error occurs … … 46 57 @Test 47 58 public void testBuildDownloadSummary() throws Exception { 48 final PluginInformation dummy = new PluginInformation( 49 new File(TestUtils.getTestDataRoot() + "plugin/dummy_plugin.jar"), "dummy_plugin"); 59 final PluginInformation dummy = getDummyPluginInformation(); 50 60 assertEquals("", PluginPreference.buildDownloadSummary( 51 61 new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.<PluginInformation>emptyList(), ""))); -
trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTest.java
r10758 r11974 15 15 import org.openstreetmap.josm.JOSMFixture; 16 16 import org.openstreetmap.josm.Main; 17 import org.openstreetmap.josm.gui.preferences.plugin.PluginPreferenceTest; 17 18 import org.openstreetmap.josm.plugins.PluginHandler.DeprecatedPlugin; 19 import org.openstreetmap.josm.plugins.PluginHandler.PluginInformationAction; 18 20 import org.openstreetmap.josm.tools.Utils; 19 21 … … 84 86 assertFalse(plugins.contains("gpsbabelgui")); 85 87 } 88 89 /** 90 * Unit test of {@link PluginInformationAction} class. 91 * @throws PluginException if an error occurs 92 */ 93 @Test 94 public void testPluginInformationAction() throws PluginException { 95 PluginInformationAction action = new PluginInformationAction(PluginPreferenceTest.getDummyPluginInformation()); 96 assertEquals( 97 "Ant-Version: Apache Ant 1.9.6\n" + 98 "Author: Don-vip\n" + 99 "Created-By: 1.7.0_91-b02 (Oracle Corporation)\n" + 100 "Manifest-Version: 1.0\n" + 101 "Plugin-Canloadatruntime: true\n" + 102 "Plugin-Class: org.openstreetmap.josm.plugins.fr.epci.EpciPlugin\n" + 103 "Plugin-Date: 2015-11-19T08:21:07.645033Z\n" + 104 "Plugin-Description: Handling of French EPCIs (boundary=local_authority)\n" + 105 "Plugin-Early: true\n" + 106 "Plugin-Link: http://wiki.openstreetmap.org/wiki/FR:JOSM/Fr:Plugin/EPCI-fr\n" + 107 "Plugin-Mainversion: 7001\n" + 108 "Plugin-Version: 31772\n", action.getText()); 109 action.actionPerformed(null); 110 } 86 111 } -
trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateParserTest.java
r11057 r11974 237 237 238 238 @Test 239 public void testSetAnd() throws ParseError { 240 TemplateParser parser = new TemplateParser("!{(parent(type=child) type=parent) & (parent type=child subtype=parent) '{name}'}"); 241 DatasetFactory ds = new DatasetFactory(); 242 Relation parent1 = ds.addRelation(1); 243 parent1.put("type", "parent"); 244 parent1.put("subtype", "parent"); 245 parent1.put("name", "name_parent1"); 246 Node child = ds.addNode(1); 247 child.put("type", "child"); 248 parent1.addMember(new RelationMember("", child)); 249 250 StringBuilder sb = new StringBuilder(); 251 TemplateEntry entry = parser.parse(); 252 entry.appendText(sb, child); 253 254 Assert.assertEquals("name_parent1", sb.toString()); 255 } 256 257 @Test 239 258 public void testSetOr() throws ParseError { 240 259 TemplateParser parser = new TemplateParser("!{(parent(type=type1) type=parent1) | (parent type=type2 type=parent2) '{name}'}");
Note:
See TracChangeset
for help on using the changeset viewer.