### Question:
ForeignKey implements Serializable, ProjectionRole<Tuple> { @SuppressWarnings("unchecked") public Predicate on(RelationalPath<E> entity) { BooleanBuilder builder = new BooleanBuilder(); for (int i = 0; i < localColumns.size(); i++) { Expression<Object> local = (Expression<Object>) localColumns.get(i); Expression<?> foreign = ExpressionUtils.path(local.getType(), entity, foreignColumns.get(i)); builder.and(ExpressionUtils.eq(local,foreign)); } return builder.getValue(); } ForeignKey(RelationalPath<?> entity, Path<?> localColumn, String foreignColumn);  ForeignKey(RelationalPath<?> entity, ImmutableList<? extends Path<?>> localColumns,
            ImmutableList<String> foreignColumns); RelationalPath<?> getEntity(); List<? extends Path<?>> getLocalColumns(); List<String> getForeignColumns(); @SuppressWarnings("unchecked") Predicate on(RelationalPath<E> entity); BooleanExpression in(SubQueryExpression<Tuple> coll); @Override Expression<Tuple> getProjection();  }### Answer:
@Test public void on() { QEmployee employee = new QEmployee("employee"); QEmployee employee2 = new QEmployee("employee2"); ForeignKey<Employee> foreignKey = new ForeignKey<Employee>(employee, employee.superiorId, "ID"); assertEquals("employee.superiorId = employee2.ID", foreignKey.on(employee2).toString()); foreignKey = new ForeignKey<Employee>(employee, ImmutableList.of(employee.superiorId, employee.firstname), ImmutableList.of("ID", "FN")); assertEquals("employee.superiorId = employee2.ID && employee.firstname = employee2.FN", foreignKey.on(employee2).toString()); }