### Question:
PositionTokenEvaluator extends TokenEvaluator<Position> { @Override public EvaluationResult evaluate( Position position, CalculationFunctions functions, String firstToken, List<String> remainingTokens) { MetaBean metaBean = MetaBean.of(position.getClass()); Optional<String> positionPropertyName = metaBean.metaPropertyMap().keySet().stream() .filter(p -> p.equalsIgnoreCase(firstToken)) .findFirst(); if (positionPropertyName.isPresent()) { Object propertyValue = metaBean.metaProperty(positionPropertyName.get()).get((Bean) position); return propertyValue != null ? EvaluationResult.success(propertyValue, remainingTokens) : EvaluationResult.failure("Property '{}' not set", firstToken); } Optional<String> positionInfoPropertyName = position.getInfo().propertyNames().stream() .filter(p -> p.equalsIgnoreCase(firstToken)) .findFirst(); if (positionInfoPropertyName.isPresent()) { Object propertyValue = position.getInfo().property(positionInfoPropertyName.get()).get(); return propertyValue != null ? EvaluationResult.success(propertyValue, remainingTokens) : EvaluationResult.failure("Property '{}' not set", firstToken); } return invalidTokenFailure(position, firstToken); }  @Override Class<Position> getTargetType(); @Override Set<String> tokens(Position position); @Override EvaluationResult evaluate(
      Position position,
      CalculationFunctions functions,
      String firstToken,
      List<String> remainingTokens);  }### Answer:
@Test public void evaluate() { PositionTokenEvaluator evaluator = new PositionTokenEvaluator(); Position pos = trade(); EvaluationResult quantity = evaluator.evaluate(pos, FUNCTIONS, "quantity", ImmutableList.of()); assertThat(quantity.getResult()).hasValue(6d); EvaluationResult initialPrice = evaluator.evaluate(pos, FUNCTIONS, "security", ImmutableList.of()); assertThat(initialPrice.getResult()).hasValue(SECURITY); EvaluationResult initialPrice2 = evaluator.evaluate(pos, FUNCTIONS, "Security", ImmutableList.of()); assertThat(initialPrice2.getResult()).hasValue(SECURITY); EvaluationResult foo = evaluator.evaluate(pos, FUNCTIONS, "foo", ImmutableList.of()); assertThat(foo.getResult()).isFailure(); }