### Question:
AssignmentFilter extends GenericHeapObject implements Filter { public AssignmentFilter addRequestBinding(final Expression<?> target) { return this.addRequestBinding(target, null); }  AssignmentFilter addRequestBinding(final Expression<?> target); AssignmentFilter addRequestBinding(final Expression<?> target, final Expression<?> value); AssignmentFilter addRequestBinding(final Expression<Boolean> condition,
                                              final Expression<?> target,
                                              final Expression<?> value); AssignmentFilter addResponseBinding(final Expression<?> target); AssignmentFilter addResponseBinding(final Expression<?> target, final Expression<?> value); AssignmentFilter addResponseBinding(final Expression<Boolean> condition,
                                               final Expression<?> target,
                                               final Expression<?> value); @Override Promise<Response, NeverThrowsException> filter(final Context context,
                                                          final Request request,
                                                          final Handler next);  }### Answer:
@Test public void onRequest() throws Exception { AssignmentFilter filter = new AssignmentFilter(); final Expression<String> target = Expression.valueOf("${attributes.newAttr}", String.class); filter.addRequestBinding(target, Expression.valueOf("${request.method}", String.class)); AttributesContext context = new AttributesContext(new RootContext()); Request request = new Request(); request.setMethod("DELETE"); final StaticResponseHandler handler = new StaticResponseHandler(Status.OK); Chain chain = new Chain(handler, singletonList((Filter) filter)); chain.handle(context, request).get(); assertThat(context.getAttributes().get("newAttr")).isEqualTo("DELETE"); }
@Test public void shouldChangeUriOnRequest() throws Exception { AssignmentFilter filter = new AssignmentFilter(); filter.addRequestBinding(Expression.valueOf("${request.uri}", String.class), Expression.valueOf("www.forgerock.com", String.class)); Context context = new RootContext(); Request request = new Request(); request.setUri("www.example.com"); Chain chain = new Chain(new StaticResponseHandler(Status.OK), singletonList((Filter) filter)); chain.handle(context, request).get(); assertThat(request.getUri().toString()).isEqualTo("www.forgerock.com"); }