### Question:
CookieEncoder { public String encode() { String answer; if (server) { answer = encodeServerSide(); } else { answer = encodeClientSide(); } cookies.clear(); return answer; } CookieEncoder(boolean server); void addCookie(String name, String value); void addCookie(Cookie cookie); String encode();  }### Answer:
@Test public void testEncodingWithNoCookies() { CookieEncoder encoderForServer = new CookieEncoder(true); String encodedCookie1 = encoderForServer.encode(); CookieEncoder encoderForClient = new CookieEncoder(false); String encodedCookie2 = encoderForClient.encode(); assertNotNull(encodedCookie1); assertNotNull(encodedCookie2); }