RequestClientOptions { void copyTo(RequestClientOptions target) { target.setReadLimit(getReadLimit()); target.setSkipAppendUriPath(isSkipAppendUriPath()); for (Marker marker: Marker.values()) target.putClientMarker(marker, getClientMarker(marker)); }  String getClientMarker(Marker marker); void putClientMarker(Marker marker, String value); void appendUserAgent(String userAgent); final int getReadLimit(); final void setReadLimit(int readLimit); boolean isSkipAppendUriPath(); void setSkipAppendUriPath(boolean skipAppendUriPath); static final int DEFAULT_STREAM_BUFFER_SIZE; }
@Test public void copyTo() { RequestClientOptions from = new RequestClientOptions(); from.appendUserAgent("useragent"); from.setReadLimit(1234); assertNotNull(from.getClientMarker(Marker.USER_AGENT)); assertTrue(1234 == from.getReadLimit()); RequestClientOptions to = new RequestClientOptions(); assertNull(to.getClientMarker(Marker.USER_AGENT)); assertFalse(1234 == to.getReadLimit()); from.copyTo(to); assertEquals(from.getClientMarker(Marker.USER_AGENT), to.getClientMarker(Marker.USER_AGENT)); assertTrue(1234 == to.getReadLimit()); }