### Question:
LowerCase implements Function { @Override public Literal evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args.length != 1) { throw new ValueExprEvaluationException("LCASE requires exactly 1 argument, got " + args.length); } if (args[0] instanceof Literal) { Literal literal = (Literal) args[0]; if (QueryEvaluationUtil.isStringLiteral(literal)) { String lexicalValue = literal.getLabel().toLowerCase(); Optional<String> language = literal.getLanguage(); if (language.isPresent()) { return valueFactory.createLiteral(lexicalValue, language.get()); } else if (XMLSchema.STRING.equals(literal.getDatatype())) { return valueFactory.createLiteral(lexicalValue, XMLSchema.STRING); } else { return valueFactory.createLiteral(lexicalValue); } } else { throw new ValueExprEvaluationException("unexpected input value for function: " + args[0]); } } else { throw new ValueExprEvaluationException("unexpected input value for function: " + args[0]); } }  @Override String getURI(); @Override Literal evaluate(ValueFactory valueFactory, Value... args);  }### Answer:
@Test public void testEvaluate1() { Literal pattern = f.createLiteral("foobar"); try { Literal result = lcaseFunc.evaluate(f, pattern); assertTrue(result.getLabel().equals("foobar")); } catch (ValueExprEvaluationException e) { fail(e.getMessage()); } }
@Test public void testEvaluate2() { Literal pattern = f.createLiteral("FooBar"); try { Literal result = lcaseFunc.evaluate(f, pattern); assertTrue(result.getLabel().equals("foobar")); } catch (ValueExprEvaluationException e) { fail(e.getMessage()); } }
@Test public void testEvaluate3() { Literal pattern = f.createLiteral("FooBar"); Literal startIndex = f.createLiteral(4); try { lcaseFunc.evaluate(f, pattern, startIndex); fail("illegal number of parameters"); } catch (ValueExprEvaluationException e) { } }