### Question:
Driver implements Wrapper { @Override public Handler wrap(final Handler handler) { return request -> specs(request).orElseGet(() -> handler.handle(request.map(this::before)).map(this::after) ); } Driver(final Shape shape); @Override Handler wrap(final Handler handler);  }### Answer:
@Test void testConfigureExchangeShape() { new Driver(TestShape) .wrap((Handler)request -> { assertThat(request) .hasShape(TestShape); return request.reply(response -> response .status(OK) .header("link", "processed") ); }) .handle(request()) .accept(response -> assertThat(response).hasHeaders("Link", "processed", "<http: )); }
@Test void testHandleSpecsQuery() { new Driver(TestShape) .wrap((Handler)request -> request.reply(response -> response)) .handle(request() .roles(None) .query("specs") ) .accept(response -> assertThat(response) .hasStatus(OK) .hasBody(text(), text -> assertThat(text) .as("redacted according to role/mode") .isEqualTo(NoneShape.toString()) ) ); }