### Question:
Buffer implements Function { @Override public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args.length != 3) { throw new ValueExprEvaluationException(getURI() + " requires exactly 3 arguments, got " + args.length); } SpatialContext geoContext = SpatialSupport.getSpatialContext(); Shape geom = FunctionArguments.getShape(this, args[0], geoContext); double radiusUom = FunctionArguments.getDouble(this, args[1]); IRI units = FunctionArguments.getUnits(this, args[2]); double radiusDegs = FunctionArguments.convertToDegrees(radiusUom, units); Shape buffered = SpatialSupport.getSpatialAlgebra().buffer(geom, radiusDegs); String wkt; try { wkt = SpatialSupport.getWktWriter().toWkt(buffered); } catch (IOException ioe) { throw new ValueExprEvaluationException(ioe); } return valueFactory.createLiteral(wkt, GEO.WKT_LITERAL); }  @Override String getURI(); @Override Value evaluate(ValueFactory valueFactory, Value... args);  }### Answer:
@Test public void testEvaluateWithDecimalRadius() { Value result = buffer.evaluate(f, point, f.createLiteral("1.0", XMLSchema.DECIMAL), unit); assertNotNull(result); }
@Test(expected = ValueExprEvaluationException.class) public void testEvaluateWithInvalidRadius() { buffer.evaluate(f, point, f.createLiteral("foobar", XMLSchema.DECIMAL), unit); }
@Test public void testEvaluateWithIntRadius() { Value result = buffer.evaluate(f, point, f.createLiteral(1), unit); assertNotNull(result); }
@Test public void testEvaluateWithDoubleRadius() { Value result = buffer.evaluate(f, point, f.createLiteral(1.0), unit); assertNotNull(result); }
@Test public void testEvaluateWithDecimalRadius() { Value result = buffer.evaluate(f, point, f.createLiteral("1.0", XSD.DECIMAL), unit); assertNotNull(result); }
@Test public void resultIsPolygonWKT() { Literal result = (Literal) buffer.evaluate(f, point, f.createLiteral(1), unit); assertNotNull(result); assertThat(result.getDatatype()).isEqualTo(GEO.WKT_LITERAL); assertThat(result.getLabel()).startsWith("POLYGON ((23.708505"); }
@Test(expected = ValueExprEvaluationException.class) public void testEvaluateWithInvalidRadius() { buffer.evaluate(f, point, f.createLiteral("foobar", XSD.DECIMAL), unit); }
@Test(expected = ValueExprEvaluationException.class) public void testEvaluateWithInvalidUnit() { buffer.evaluate(f, point, f.createLiteral(1.0), FOAF.PERSON); }