Add documentation and fixes to AbstractExternalSOPTest

This commit is contained in:
Paul Schaub 2023-01-19 18:00:41 +01:00
parent 0616cde6fd
commit 104b3a4ec4
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -16,6 +16,7 @@ import java.io.InputStream;
import java.util.Properties; import java.util.Properties;
import static org.junit.jupiter.api.Assumptions.assumeFalse; import static org.junit.jupiter.api.Assumptions.assumeFalse;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
public abstract class AbstractExternalSOPTest { public abstract class AbstractExternalSOPTest {
@ -25,6 +26,7 @@ public abstract class AbstractExternalSOPTest {
public AbstractExternalSOPTest() { public AbstractExternalSOPTest() {
String backend = readSopBackendFromProperties(); String backend = readSopBackendFromProperties();
assumeTrue(backend != null);
Properties environment = readBackendEnvironment(); Properties environment = readBackendEnvironment();
sop = new ExternalSOP(backend, environment); sop = new ExternalSOP(backend, environment);
} }
@ -51,11 +53,33 @@ public abstract class AbstractExternalSOPTest {
return new File(binary).exists(); return new File(binary).exists();
} }
/**
* Relational enum.
*/
public enum Is { public enum Is {
/**
* Less than.
*/
le("<"), le("<"),
/**
* Less or equal than.
*/
leq("<="), leq("<="),
/**
* Equal.
*/
eq("=="), eq("=="),
/**
* Not equal.
*/
neq("!="),
/**
* Greater or equal than.
*/
geq(">="), geq(">="),
/**
* Greater than.
*/
ge(">"), ge(">"),
; ;
@ -105,6 +129,9 @@ public abstract class AbstractExternalSOPTest {
case eq: case eq:
assumeFalse(res == 0, msg); assumeFalse(res == 0, msg);
break; break;
case neq:
assumeFalse(res != 0, msg);
break;
case geq: case geq:
assumeFalse(res >= 0, msg); assumeFalse(res >= 0, msg);
break; break;
@ -127,8 +154,7 @@ public abstract class AbstractExternalSOPTest {
} }
properties.load(resourceIn); properties.load(resourceIn);
String backend = properties.getProperty("sop.backend"); return properties.getProperty("sop.backend");
return backend;
} catch (IOException e) { } catch (IOException e) {
return null; return null;
} }