### Question:
MappingProjection extends FactoryExpressionBase<T> { @Override public T newInstance(Object... values) { return map(qTuple.newInstance(values)); } @SuppressWarnings("unchecked")  MappingProjection(Class<? super T> type, Expression<?>... args); @SuppressWarnings("unchecked")  MappingProjection(Class<? super T> type, Expression<?>[]... args); @Override T newInstance(Object... values); @Override List<Expression<?>> getArgs(); @Override R accept(Visitor<R, C> v, @Nullable C context);  }### Answer:
@SuppressWarnings("serial") @Test public void two_args() { MappingProjection<Pair<String,String>> mapping = new MappingProjection<Pair<String,String>>(Pair.class, str1, str2) { @Override protected Pair<String, String> map(Tuple row) { return Pair.of(row.get(str1), row.get(str2)); } }; Pair<String, String> pair = mapping.newInstance("1", "2"); assertEquals("1", pair.getFirst()); assertEquals("2", pair.getSecond()); }
@SuppressWarnings("serial") @Test public void single_arg() { MappingProjection<String> mapping = new MappingProjection<String>(String.class, str1) { @Override protected String map(Tuple row) { return row.get(str1); } }; assertEquals("1", mapping.newInstance("1")); }