diff --git a/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/FourNumberVersioningSystemTest.java b/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/FourNumberVersioningSystemTest.java index 92c57cd..d31dfa9 100644 --- a/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/FourNumberVersioningSystemTest.java +++ b/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/FourNumberVersioningSystemTest.java @@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.fail; * Tests the class {@link FourNumberVersioningSystem}. */ @SuppressWarnings({ "unused" }) -@DisplayName("SemanticVersioningSystem") +@DisplayName("FourNumberVersioningSystem") public class FourNumberVersioningSystemTest { /** * The unit logger for this instance. diff --git a/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/OneNumberVersioningSystemTest.java b/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/OneNumberVersioningSystemTest.java new file mode 100644 index 0000000..d83d81b --- /dev/null +++ b/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/OneNumberVersioningSystemTest.java @@ -0,0 +1,71 @@ +/* + * STAROPENSOURCE ENGINE SOURCE FILE + * Copyright (c) 2024 The StarOpenSource Engine Contributors + * Licensed under the GNU Affero General Public License v3 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.staropensource.sosengine.base.srctests.data.versioning; + +import de.staropensource.sosengine.base.data.versioning.OneNumberVersioningSystem; +import de.staropensource.sosengine.base.data.versioning.TwoNumberVersioningSystem; +import de.staropensource.sosengine.base.exceptions.InvalidVersionStringException; +import de.staropensource.sosengine.unittests.UnitLogger; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; + +/** + * Tests the class {@link TwoNumberVersioningSystem}. + */ +@SuppressWarnings({ "unused" }) +@DisplayName("OneNumberVersioningSystem") +public class OneNumberVersioningSystemTest { + /** + * The unit logger for this instance. + */ + private static final UnitLogger logger = new UnitLogger(OneNumberVersioningSystemTest.class); + private static final Logger log = LoggerFactory.getLogger(OneNumberVersioningSystemTest.class); + + /** + * Tests the method {@code compare}. + */ + @ParameterizedTest + @DisplayName("compare") + @CsvSource({ + "1, 0, 0", + "1, 1, 1", + "1, 2, 2", + }) + void testCompare(String a, String b, int expected) throws Throwable { + logger.testCall("testCompare", a, b, expected); + + try { + assertEquals(expected, new OneNumberVersioningSystem(a).compare(new OneNumberVersioningSystem(b))); + } catch (InvalidVersionStringException exception) { + logger.error("Got InvalidVersionStringException: " + exception.getMessage()); + if (exception.getThrowable() != null) { + logger.error("Original stack trace:"); + throw exception.getThrowable(); + } + fail("Got InvalidVersionStringException"); + } + } +} diff --git a/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/StarOpenSourceVersioningSystemTest.java b/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/StarOpenSourceVersioningSystemTest.java index 93d1940..697e718 100644 --- a/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/StarOpenSourceVersioningSystemTest.java +++ b/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/StarOpenSourceVersioningSystemTest.java @@ -34,7 +34,7 @@ import static org.junit.jupiter.api.Assertions.fail; * Tests the class {@link SemanticVersioningSystem}. */ @SuppressWarnings({ "unused" }) -@DisplayName("SemanticVersioningSystem") +@DisplayName("StarOpenSourceVersioningSystem") public class StarOpenSourceVersioningSystemTest { /** * The unit logger for this instance. diff --git a/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/ThreeNumberVersioningSystemTest.java b/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/ThreeNumberVersioningSystemTest.java index cab8198..3583951 100644 --- a/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/ThreeNumberVersioningSystemTest.java +++ b/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/ThreeNumberVersioningSystemTest.java @@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.fail; * Tests the class {@link ThreeNumberVersioningSystem}. */ @SuppressWarnings({ "unused" }) -@DisplayName("SemanticVersioningSystem") +@DisplayName("ThreeNumberVersioningSystem") public class ThreeNumberVersioningSystemTest { /** * The unit logger for this instance. diff --git a/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/TwoNumberVersioningSystemTest.java b/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/TwoNumberVersioningSystemTest.java index e1394e1..cf8bbcb 100644 --- a/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/TwoNumberVersioningSystemTest.java +++ b/base/src/test/java/de/staropensource/sosengine/base/srctests/data/versioning/TwoNumberVersioningSystemTest.java @@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.fail; * Tests the class {@link TwoNumberVersioningSystem}. */ @SuppressWarnings({ "unused" }) -@DisplayName("SemanticVersioningSystem") +@DisplayName("TwoNumberVersioningSystem") public class TwoNumberVersioningSystemTest { /** * The unit logger for this instance.