Compare commits

..

No commits in common. "8caafd6d0179da6f76b39bc60cd64993eb16e6c5" and "6785ec64d3d185dbcd833882a31c771a7744d697" have entirely different histories.

2 changed files with 12 additions and 20 deletions

View file

@ -177,30 +177,14 @@ public final class DependencyResolver {
for (char character : dependency.toCharArray()) { for (char character : dependency.toCharArray()) {
switch (character) { switch (character) {
case '=' -> { case '=' -> {
// Check for duplicate
if (duplicateCheck[0])
throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot include multiple '=' characters");
// Update mode
mode = 1; mode = 1;
continue; continue;
} }
case '<' -> { case '<' -> {
// Check for duplicate
if (duplicateCheck[1])
throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot include multiple '<' characters");
// Update mode
mode = 2; mode = 2;
continue; continue;
} }
case '>' -> { case '>' -> {
// Check for duplicate
if (duplicateCheck[2])
throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot include multiple '>' characters");
// Update mode
mode = 3; mode = 3;
continue; continue;
} }
@ -211,6 +195,9 @@ public final class DependencyResolver {
case 0 -> identifier.append(character); case 0 -> identifier.append(character);
// Version equal // Version equal
case 1 -> { case 1 -> {
// Check for duplicate
if (character == '=' && duplicateCheck[0])
throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot include multiple '=' characters");
duplicateCheck[0] = true; duplicateCheck[0] = true;
// Check for smaller and bigger than // Check for smaller and bigger than
@ -221,6 +208,9 @@ public final class DependencyResolver {
} }
// Version smaller // Version smaller
case 2 -> { case 2 -> {
// Check for duplicate
if (character == '<' && duplicateCheck[1])
throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot include multiple '<' characters");
duplicateCheck[1] = true; duplicateCheck[1] = true;
// Check for equal // Check for equal
@ -231,6 +221,9 @@ public final class DependencyResolver {
} }
// Version bigger // Version bigger
case 3 -> { case 3 -> {
// Check for duplicate
if (character == '>' && duplicateCheck[2])
throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot include multiple '>' characters");
duplicateCheck[2] = true; duplicateCheck[2] = true;
// Check for equal // Check for equal

View file

@ -19,6 +19,7 @@
package de.staropensource.sosengine.base.srctests.utility; package de.staropensource.sosengine.base.srctests.utility;
import de.staropensource.sosengine.base.Engine;
import de.staropensource.sosengine.base.exception.dependency.UnmetDependenciesException; import de.staropensource.sosengine.base.exception.dependency.UnmetDependenciesException;
import de.staropensource.sosengine.base.implementation.versioning.OneNumberVersioningSystem; import de.staropensource.sosengine.base.implementation.versioning.OneNumberVersioningSystem;
import de.staropensource.sosengine.base.srctests.TestBase; import de.staropensource.sosengine.base.srctests.TestBase;
@ -32,7 +33,7 @@ import org.junit.jupiter.params.provider.ValueSource;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull;
/** /**
* Tests the class {@link DependencyResolver}. * Tests the class {@link DependencyResolver}.
@ -269,8 +270,6 @@ class DependencyResolverTest extends TestBase {
getLogger().error("Dependency resolution failed: Unmet dependencies found:"); getLogger().error("Dependency resolution failed: Unmet dependencies found:");
for (DependencyVector vector : exception.getUnmetDependencies().keySet()) for (DependencyVector vector : exception.getUnmetDependencies().keySet())
getLogger().error("-> " + vector.getIdentifier() + "=" + vector.getVersion() + ": " + exception.getUnmetDependencies().get(vector)); getLogger().error("-> " + vector.getIdentifier() + "=" + vector.getVersion() + ": " + exception.getUnmetDependencies().get(vector));
assertEquals("Please ignore this, this just exists to trigger an error", "", "Dependency resolution failed (layers=" + layers + "): See logs");
} }
} }
@ -490,6 +489,6 @@ class DependencyResolverTest extends TestBase {
return; return;
} }
assertEquals("Please ignore this, this just exists to trigger an error", "", "Dependency resolution succeeded (layers=" + layers + ")"); assertNotNull(Engine.getInstance(), "Dependency resolution succeeded (layers=" + layers + ")");
} }
} }