|
| 1 | +package eu.europa.ted.eforms.sdk; |
| 2 | + |
| 3 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 4 | + |
| 5 | +import org.junit.jupiter.api.Test; |
| 6 | + |
| 7 | +public class SdkVersionTest { |
| 8 | + @Test |
| 9 | + void testGetMajor() { |
| 10 | + assertEquals("1", new SdkVersion("1.2.3").getMajor()); |
| 11 | + } |
| 12 | + |
| 13 | + @Test |
| 14 | + void testGetMinor() { |
| 15 | + assertEquals("2", new SdkVersion("1.2.3").getMinor()); |
| 16 | + } |
| 17 | + |
| 18 | + @Test |
| 19 | + void testGetPatch() { |
| 20 | + assertEquals("3", new SdkVersion("1.2.3").getPatch()); |
| 21 | + } |
| 22 | + |
| 23 | + @Test |
| 24 | + void testGetNextMajor() { |
| 25 | + assertEquals("2.2.3", new SdkVersion("1.2.3").getNextMajor()); |
| 26 | + } |
| 27 | + |
| 28 | + @Test |
| 29 | + void testGetNextMinor() { |
| 30 | + assertEquals("1.3.3", new SdkVersion("1.2.3").getNextMinor()); |
| 31 | + } |
| 32 | + |
| 33 | + @Test |
| 34 | + void testIsPatch() { |
| 35 | + assertEquals(false, new SdkVersion("1.2").isPatch()); |
| 36 | + |
| 37 | + assertEquals(true, new SdkVersion("1.2.3").isPatch()); |
| 38 | + // FIXME |
| 39 | + //assertEquals(true, new SdkVersion("1.2.3-rc.4").isPatch()); |
| 40 | + } |
| 41 | + |
| 42 | + @Test |
| 43 | + void testToNormalisedStringWithPatch() { |
| 44 | + assertEquals("1.2.3", new SdkVersion("1.2.3").toNormalisedString(true)); |
| 45 | + // FIXME |
| 46 | + //assertEquals("1.2.3", new SdkVersion("1.2.3-SNAPSHOT").toNormalisedString(true)); |
| 47 | + //assertEquals("1.2.3", new SdkVersion("1.2.3-rc.4").toNormalisedString(true)); |
| 48 | + } |
| 49 | + |
| 50 | + @Test |
| 51 | + void testToStringWithoutPatch() { |
| 52 | + assertEquals("1.2", new SdkVersion("1.2.3").toStringWithoutPatch()); |
| 53 | + assertEquals("1.2", new SdkVersion("1.2.3-SNAPSHOT").toStringWithoutPatch()); |
| 54 | + // FIXME |
| 55 | + //assertEquals("1.2", new SdkVersion("1.2.3-rc.4").toStringWithoutPatch()); |
| 56 | + } |
| 57 | + |
| 58 | + @Test |
| 59 | + void testCompare() { |
| 60 | + assert(new SdkVersion("1.2.3").compareTo(new SdkVersion("1.2.2")) > 0); |
| 61 | + assert(new SdkVersion("1.2.3").compareTo(new SdkVersion("1.2")) > 0); |
| 62 | + assert(new SdkVersion("1.2.3").compareTo(new SdkVersion("1.2.3-SNAPSHOT")) > 0); |
| 63 | + // FIXME |
| 64 | + //assert(new SdkVersion("1.2.3").compareTo(new SdkVersion("1.2.3-rc.3")) > 0); |
| 65 | + //assert(new SdkVersion("2.0.0").compareTo(new SdkVersion("2.0.0-alpha.1")) > 0); |
| 66 | + } |
| 67 | +} |
0 commit comments