### Question:
LeftExpression implements Expression { @Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ExpressionResult value = valueExpression.apply(context, input); if( value == null || ! value.isNonNull() ) return NullExpressionResult.INSTANCE; int chars = charsExpression.apply(context, input).getNumericValue().intValue(); String string = value.toString(); if( string.length() < chars) return new StringExpressionResult(string); return new StringExpressionResult(string.substring(0, chars)); } LeftExpression(String alias, Expression[] expressions); @Override ExpressionResult apply(ExpressionContext context, ExpressionResult input); @Override String alias();  }### Answer:
@Test public void normalLeft() { ExpressionResult actual = testSubject.apply(expressionContext, mapValue("value", stringValue("abcdefg"))); assertEquals("ab", actual.getValue()); }
@Test public void tooShort() { ExpressionResult actual = testSubject.apply(expressionContext, mapValue("value", stringValue("a"))); assertEquals("a", actual.getValue()); }