### Question:
SubstringExpression implements Expression, PipeExpression { @Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ExpressionResult value = expressions[0].apply(context, input); return (value != null && value.isNonNull()) ? new StringExpressionResult(doSubstring(context, input, value.toString())) : NullExpressionResult.INSTANCE ; } SubstringExpression(String alias, Expression[] expressions); @Override ExpressionResult apply(ExpressionContext context, ExpressionResult input); @Override String alias(); @Override boolean process(ExpressionContext context, QueryResult result, Pipeline next); @Override List<String> getColumnNames(List<String> inputColumns);  }### Answer:
@Test public void normalSubstring() { ExpressionResult actual = testSubject.apply(expressionContext, mapValue("value", stringValue("abcdefg"))); assertEquals("bcd", actual.getValue()); }
@Test public void normalSubstringOnlyStart() { ExpressionResult actual = testSubject2.apply(expressionContext, mapValue("value", stringValue("abcdefg"), "start", numericValue(1))); assertEquals("bcdefg", actual.getValue()); }
@Test public void tooShort() { ExpressionResult actual = testSubject.apply(expressionContext, mapValue("value", stringValue("abc"))); assertEquals("bc", actual.getValue()); }
@Test public void tooShort2() { ExpressionResult actual = testSubject.apply(expressionContext, mapValue("value", stringValue(""))); assertEquals("", actual.getValue()); }