use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.
the class VersionDataTest method testDecode.
/**
* Test method for {@link com.sldeditor.common.vendoroption.VersionData#decode(java.lang.Class, java.lang.String)}.
* Test method for {@link com.sldeditor.common.vendoroption.VersionData#getVersionString()}.
*/
@Test
public void testDecode() {
assertNull(VersionData.decode(null, null));
String expectedVersionString1 = "1.2.3";
VersionData versionData1 = VersionData.decode(getClass(), expectedVersionString1);
assertEquals(getClass(), versionData1.getVendorOptionType());
assertEquals(expectedVersionString1, versionData1.getVersionString());
String expectedVersionString2 = "1.2";
VersionData versionData2 = VersionData.decode(getClass(), expectedVersionString2);
assertEquals(expectedVersionString2, versionData2.getVersionString());
String expectedVersionString3 = "1";
VersionData versionData3 = VersionData.decode(getClass(), expectedVersionString3);
assertEquals(expectedVersionString3, versionData3.getVersionString());
String expectedVersionString4 = "";
VersionData versionData4 = VersionData.decode(getClass(), expectedVersionString4);
assertNull(versionData4);
String expectedVersionString5 = "1,2,3";
VersionData versionData5 = VersionData.decode(getClass(), expectedVersionString5);
assertNull(versionData5);
String expectedVersionString6 = "1.2.3a";
VersionData versionData6 = VersionData.decode(getClass(), expectedVersionString6);
assertNull(versionData6);
String expectedVersionString7 = "Latest";
VersionData versionData7 = VersionData.decode(getClass(), expectedVersionString7);
assertEquals(expectedVersionString7, versionData7.getVersionString());
String expectedVersionString8 = "first";
VersionData versionData8 = VersionData.decode(getClass(), expectedVersionString8);
assertEquals(expectedVersionString8, versionData8.getVersionString());
String expectedVersionString9 = "1.2.3-SNAPSHOT";
VersionData versionData9 = VersionData.decode(getClass(), expectedVersionString9);
assertEquals(expectedVersionString9, versionData9.getVersionString());
}
use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.
the class VersionDataTest method testEncodedString.
/**
* Test method for {@link com.sldeditor.common.vendoroption.VersionData#getEncodedString()}.
* Test method for {@link com.sldeditor.common.vendoroption.VersionData#getDecodedString(java.lang.String)}.
*/
@Test
public void testEncodedString() {
VersionData versionData1 = VersionData.decode(getClass(), "2.4.1");
String encodeString1 = versionData1.getEncodedString();
VersionData versionData1Decoded = VersionData.getDecodedString(encodeString1);
assertEquals(versionData1, versionData1Decoded);
VersionData versionData2 = VersionData.getEarliestVersion(getClass());
String encodeString2 = versionData2.getEncodedString();
VersionData versionData2Decoded = VersionData.getDecodedString(encodeString2);
assertEquals(versionData2, versionData2Decoded);
VersionData versionData3 = VersionData.getLatestVersion(getClass());
String encodeString3 = versionData3.getEncodedString();
VersionData versionData3Decoded = VersionData.getDecodedString(encodeString3);
assertEquals(versionData3, versionData3Decoded);
}
use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.
the class VersionDataTest method testGetEarliestVersion.
/**
* Test method for {@link com.sldeditor.common.vendoroption.VersionData#getEarliestVersion(java.lang.Class)}.
*/
@Test
public void testGetEarliestVersion() {
VersionData earliest = VersionData.getEarliestVersion(getClass());
assertEquals("First", earliest.getVersionString());
}
use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.
the class VersionDataTest method testGetNotSetVersion.
/**
* Test method for {@link com.sldeditor.common.vendoroption.VersionData#getNotSetVersion(java.lang.Class)}.
* Test method for {@link com.sldeditor.common.vendoroption.VersionData#isNotSet()}.
*/
@Test
public void testGetNotSetVersion() {
VersionData latest = VersionData.getLatestVersion(getClass());
assertFalse(latest.isNotSet());
VersionData notSet = VersionData.getNotSetVersion(getClass());
assertTrue(notSet.isNotSet());
}
use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.
the class VersionDataTest method testInRange.
/**
* Test method for {@link com.sldeditor.common.vendoroption.VersionData#inRange(com.sldeditor.common.vendoroption.VersionData, com.sldeditor.common.vendoroption.VersionData)}.
*/
@Test
public void testInRange() {
VersionData versionDataMin = VersionData.decode(getClass(), "2.4.1");
VersionData versionDataMax = VersionData.decode(getClass(), "2.8.3");
VersionData versionData1 = VersionData.decode(getClass(), "1.2");
VersionData versionData2 = VersionData.decode(getClass(), "2.4.0");
VersionData versionData3 = VersionData.decode(getClass(), "2.4.1");
// CHECKSTYLE:OFF
VersionData versionData4 = VersionData.decode(getClass(), "2.5.1");
VersionData versionData5 = VersionData.decode(getClass(), "2.8.3");
VersionData versionData6 = VersionData.decode(getClass(), "2.8.4");
VersionData versionData7 = VersionData.getNotSetVersion(getClass());
// CHECKSTYLE:ON
assertFalse(versionData1.inRange(versionDataMin, versionDataMax));
assertFalse(versionData2.inRange(versionDataMin, versionDataMax));
assertTrue(versionData3.inRange(versionDataMin, versionDataMax));
assertTrue(versionData4.inRange(versionDataMin, versionDataMax));
assertTrue(versionData5.inRange(versionDataMin, versionDataMax));
assertFalse(versionData6.inRange(versionDataMin, versionDataMax));
assertFalse(versionData7.inRange(versionDataMin, versionDataMax));
assertFalse(versionData1.inRange(null, versionDataMax));
assertFalse(versionData1.inRange(versionDataMin, null));
assertFalse(versionData1.inRange(null, null));
}
Aggregations