Skip to content

Commit 45b2f04

Browse files
committed
Inputs that are blank or not supplied are no longer validated. #10
In the initial staging steps, all inputs with an associated table are validated against that table. If an input is not supplied and there is no default, we are no longer validating them. In addition, blank inputs are also not validated.
1 parent 078229f commit 45b2f04

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
}
99

1010
group = 'com.imsweb'
11-
version = '1.4.2'
11+
version = '1.4.3-SNAPSHOT'
1212
description = 'Java client library for staging calculations'
1313

1414
println "Starting build using ${Jvm.current()}"

src/main/java/com/imsweb/decisionengine/DecisionEngine.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,11 @@ public Result process(Definition definition, Map<String, String> context) {
591591
context.put(input.getKey(), value);
592592
}
593593

594-
// otherwise validate value against associated table, if supplied
594+
// if a value if not supplied, or blank, there is no need to validate it against the table
595+
if (value.isEmpty())
596+
continue;
597+
598+
// validate value against associated table, if supplied
595599
if (input.getTable() != null) {
596600
Table lookup = getProvider().getTable(input.getTable());
597601

src/test/java/com/imsweb/staging/cs/CsStagingTest.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,15 +355,26 @@ public void testBlankValues() {
355355
Assert.assertEquals("brain", data.getSchemaId());
356356
Assert.assertEquals(0, data.getErrors().size());
357357

358-
// now change SSF4 to blank; it should produce an error now since the default will not be used
358+
// now change SSF4 to blank; blank values are not validated and since this is not used in staging there should be no errors
359359
data.setSsf(4, "");
360360

361361
// perform the staging
362362
_STAGING.stage(data);
363363

364364
Assert.assertEquals(Result.STAGED, data.getResult());
365365
Assert.assertEquals("brain", data.getSchemaId());
366-
Assert.assertEquals(1, data.getErrors().size());
366+
Assert.assertEquals(0, data.getErrors().size());
367+
368+
// now change extension to blank; the only errors we get should be of type MATCH_NOT_FOUND
369+
data.setInput(CsInput.EXTENSION, "");
370+
371+
// perform the staging
372+
_STAGING.stage(data);
373+
374+
Assert.assertEquals(Result.STAGED, data.getResult());
375+
Assert.assertEquals("brain", data.getSchemaId());
376+
for (com.imsweb.decisionengine.Error error : data.getErrors())
377+
Assert.assertEquals(Type.MATCH_NOT_FOUND, error.getType());
367378
}
368379

369380
@Test

0 commit comments

Comments
 (0)