OptionJuggle { public static Response setRealCodeResponse(Response response, ResponseCode realCode) { return responseWithNewCode(response, realCode); }  static OptionSet prepareUoptions(OptionSet options); static OptionSet prepareEoptions(OptionSet options); static OptionSet discardEOptions(OptionSet optionSet); static Request setFakeCodeRequest(Request request); static Request setRealCodeRequest(Request request, Code realCode); static Response setFakeCodeResponse(Response response); static Response setRealCodeResponse(Response response, ResponseCode realCode); static OptionSet merge(OptionSet eOptions, OptionSet uOptions);  }
@Test public void testRealCodeResponse() { Response response = new Response(ResponseCode.CHANGED); response.setToken(token); response.setMID(mid); response.setType(type); response.setPayload(payload); response.setSourceContext(sourceContext); response.setDestinationContext(destinationContext); OptionSet options = new OptionSet(); options.setAccept(accept); response.setOptions(options); ResponseCode realCode = ResponseCode.CONTENT; Response realed = OptionJuggle.setRealCodeResponse(response, realCode); OptionSet realOptions = realed.getOptions(); assertEquals(realCode, realed.getCode()); assertEquals(token, realed.getToken()); assertEquals(mid, realed.getMID()); assertEquals(type, realed.getType()); assertEquals(payload, realed.getPayload()); assertEquals(sourceContext, realed.getSourceContext()); assertEquals(destinationContext, realed.getDestinationContext()); assertEquals(accept, realOptions.getAccept()); }