Skip to content

Commit

Permalink
Review comments - update tests for exception msg
Browse files Browse the repository at this point in the history
Signed-off-by: currantw <[email protected]>
  • Loading branch information
currantw committed Feb 7, 2025
1 parent b51affc commit 4542d11
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ private static ExprValue flattenExprValueAtPath(ExprValue rootExprValue, String
}

ExprValue childExprValue = exprValueMap.get(path);
if (!childExprValue.isNull() && !childExprValue.isMissing()) {
exprValueMap.putAll(ExprValueUtils.getTupleValue(childExprValue));
if (childExprValue.isNull() || childExprValue.isMissing()) {
return rootExprValue;
}

exprValueMap.putAll(ExprValueUtils.getTupleValue(childExprValue));
return ExprTupleValue.fromExprValueMap(exprValueMap);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,17 @@ void testInvalidName() {

@Test
void testInvalidDuplicate() {
Exception ex;
String msg;

ex = assertThrows(SemanticCheckException.class, () -> executeFlatten("duplicate"));
assertEquals("Flatten command cannot overwrite fields: integer_value", ex.getMessage());
msg =
assertThrows(SemanticCheckException.class, () -> executeFlatten("duplicate")).getMessage();
assertTrue(msg.contains("integer_value"));

ex = assertThrows(SemanticCheckException.class, () -> executeFlatten("duplicate_2"));
assertEquals(
"Flatten command cannot overwrite fields: integer_value, double_value", ex.getMessage());
msg =
assertThrows(SemanticCheckException.class, () -> executeFlatten("duplicate_2"))
.getMessage();
assertTrue(msg.contains("integer_value"));
assertTrue(msg.contains("double_value"));
}

/**
Expand Down

0 comments on commit 4542d11

Please sign in to comment.