Changeset 11899 in josm
- Timestamp:
- 2017-04-13T22:40:03+02:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Version.java
r11889 r11899 178 178 int v = getVersion(); 179 179 String s = (v == JOSM_UNKNOWN_VERSION) ? "UNKNOWN" : Integer.toString(v); 180 if (buildName != null ) {180 if (buildName != null && !buildName.isEmpty()) { 181 181 s += ' ' + buildName; 182 182 } -
trunk/test/unit/org/openstreetmap/josm/data/VersionTest.java
r10300 r11899 2 2 package org.openstreetmap.josm.data; 3 3 4 import static org.junit.Assert.assertEquals; 4 5 import static org.junit.Assert.assertTrue; 6 7 import java.io.ByteArrayInputStream; 8 import java.nio.charset.StandardCharsets; 5 9 6 10 import org.junit.BeforeClass; … … 27 31 public void testGetAgentString() { 28 32 String v = Version.getInstance().getAgentString(false); 29 assertTrue(v.startsWith("JOSM/1.5 (")); 30 assertTrue(v.endsWith(" en)")); 33 assertTrue(v, v.matches("JOSM/1\\.5 \\([1-9][0-9]* SVN en\\)")); 31 34 v = Version.getInstance().getAgentString(true); 32 assertTrue(v.startsWith("JOSM/1.5 (")); 33 assertTrue(v.contains(" en) ")); 35 assertTrue(v, v.matches("JOSM/1\\.5 \\([1-9][0-9]* SVN en\\).*")); 36 } 37 38 /** 39 * Unit test of {@link Version#initFromRevisionInfo} - null case. 40 */ 41 @Test 42 public void testInitFromRevisionInfoNull() { 43 Version v = new Version(); 44 v.initFromRevisionInfo(null); 45 assertEquals(Version.JOSM_UNKNOWN_VERSION, v.getVersion()); 46 } 47 48 /** 49 * Unit test of {@link Version#initFromRevisionInfo} - local build. 50 */ 51 @Test 52 public void testInitFromRevisionInfoLocal() { 53 Version v = new Version(); 54 v.initFromRevisionInfo(new ByteArrayInputStream(("\n" + 55 "Revision: 11885\n" + 56 "Is-Local-Build: true\n" + 57 "Build-Date: 2017-04-12 02:08:29\n" 58 ).getBytes(StandardCharsets.UTF_8))); 59 assertEquals(11885, v.getVersion()); 60 assertEquals("11885", v.getVersionString()); 61 assertTrue(v.isLocalBuild()); 34 62 } 35 63 }
Note:
See TracChangeset
for help on using the changeset viewer.