Skip to content

Commit

Permalink
[#690] Test coverage: Improve sonar quality metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
opatrascoiu committed Jul 23, 2024
1 parent 42ebb2c commit baed162
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ protected Triple makeCondition(String feelOperator, Expression<Type> leftOperand

protected Triple makeCondition(String feelOperator, Triple leftOpd, Triple rightOpd, NativeOperator javaOperator) {
if (javaOperator == null) {
handleError(String.format("Operator '%s' cannot be applied to '%s' and '%s'", feelOperator, leftOpd, rightOpd));
handleError(makeOperatorErrorMessage(feelOperator, leftOpd, rightOpd));
return null;
} else {
if (javaOperator.getCardinality() == 2) {
Expand All @@ -809,7 +809,7 @@ protected Triple makeCondition(String feelOperator, Triple leftOpd, Triple right
}
}
} else {
handleError(String.format("Operator '%s' cannot be applied to '%s' and '%s'", feelOperator, leftOpd, rightOpd));
handleError(makeOperatorErrorMessage(feelOperator, leftOpd, rightOpd));
return null;
}
}
Expand All @@ -820,7 +820,7 @@ protected String rangeOperator(String feelOperatorName, Expression<Type> leftOpe
if (javaOperator != null) {
return javaOperator.getName();
} else {
handleError(String.format("Operator '%s' cannot be applied to '%s' and '%s'", feelOperatorName, leftOperand, rightOperand));
handleError(makeOperatorErrorMessage(feelOperatorName, leftOperand, rightOperand));
return null;
}
}
Expand Down Expand Up @@ -851,4 +851,8 @@ private Triple nameToTriple(String name, String javaName) {
return this.triples.name(javaName);
}
}

private static String makeOperatorErrorMessage(String feelOperator, Object leftOpd, Object rightOpd) {
return String.format("Operator '%s' cannot be applied to '%s' and '%s'", feelOperator, leftOpd, rightOpd);
}
}

0 comments on commit baed162

Please sign in to comment.