Skip to content
Snippets Groups Projects
Commit 0f2c9da8 authored by Jonas Blatt's avatar Jonas Blatt :ant:
Browse files

getBoundaryFromText should return no optional

parent cb4cfbf8
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,6 @@ import de.unikoblenz.fgbks.base.utils.boundary.impl.InvalidBoundary;
import de.unikoblenz.fgbks.base.utils.boundary.impl.LongBoundary;
import de.unikoblenz.fgbks.base.utils.boundary.impl.StringBoundary;
import java.time.LocalDateTime;
import java.util.Optional;
import org.camunda.bpm.model.dmn.instance.TypeRef;
/**
......@@ -103,11 +102,11 @@ public enum VTypeRef {
* @param text the String to parse the new {@link Boundary}
* @return a Optional of a new {@link Boundary}
*/
public Optional<Boundary> getBoundaryFromText(String text) {
public Boundary getBoundaryFromText(String text) {
try {
return Optional.of(boundaryClass.getDeclaredConstructor(String.class).newInstance(text));
return boundaryClass.getDeclaredConstructor(String.class).newInstance(text);
} catch (Exception ignored) {
return Optional.of(InvalidBoundary.getInstance());
return InvalidBoundary.getInstance();
}
}
......
......@@ -73,7 +73,7 @@ public class VDmnInputValueImpl extends VDmnValueImpl implements VDmnInputValue
// create boundary, if not created before
if (value.boundary == null) {
value.boundary =
value.dmnColumn.getTypeRef().getBoundaryFromText(value.getText()).orElse(null);
value.dmnColumn.getTypeRef().getBoundaryFromText(value.getText());
}
return super.build();
}
......
......@@ -25,7 +25,7 @@ public abstract class AbstractCheckerTest {
}
private void doCheck(VTypeRef type, String b1, String b2, boolean expected) {
doCheck(type.getBoundaryFromText(b1).get(), type.getBoundaryFromText(b2).get(), expected);
doCheck(type.getBoundaryFromText(b1), type.getBoundaryFromText(b2), expected);
}
private void doCheck(Boundary b1, Boundary b2, boolean expected) {
......
......@@ -19,7 +19,7 @@ public abstract class AbstractStringCheckerTest {
}
private void doCheck(VTypeRef type, String b1, String b2, boolean expected) {
doCheck(type.getBoundaryFromText(b1).get(), type.getBoundaryFromText(b2).get(), expected);
doCheck(type.getBoundaryFromText(b1), type.getBoundaryFromText(b2), expected);
}
private void doCheck(Boundary b1, Boundary b2, boolean expected) {
......
......@@ -15,7 +15,7 @@ class CheckStringInContactTest extends AbstractStringCheckerTest {
doStringCheck("\"a\"", "not(\"b\")", true);
doStringCheck("\"a\"", "\"a\",\"b\"", true);
doStringCheck("\"a\"", "\"c\",\"b\"", false);
doStringCheck("\"a\"", "not(\"a\",\"b\")", true);
doStringCheck("\"a\"", "not(\"a\",\"b\")", false);
doStringCheck("\"a\"", "not(\"c\",\"b\")", true);
doStringCheck("", "not(\"c\",\"b\")", true);
doStringCheck("", "\"c\",\"b\"", true);
......
......@@ -15,7 +15,7 @@ class CheckStringNotInContactTest extends AbstractStringCheckerTest {
doStringCheck("\"a\"", "not(\"b\")", false);
doStringCheck("\"a\"", "\"a\",\"b\"", false);
doStringCheck("\"a\"", "\"c\",\"b\"", true);
doStringCheck("\"a\"", "not(\"a\",\"b\")", false);
doStringCheck("\"a\"", "not(\"a\",\"b\")", true);
doStringCheck("\"a\"", "not(\"c\",\"b\")", false);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment