### Question:
CookieUtil { public static String setCookie(String cookieHeader, String name, String value) { StringBuilder sb = new StringBuilder(); int counter = 0; if (StringUtils.isNotBlank(cookieHeader)) { for (final String cookie : cookieHeader.split(";")) { final String[] cookieParts = cookie.split("=", 2); if (StringUtils.equals(StringUtils.trim(cookieParts[0]), name)) continue; if (counter++ > 0) sb.append(';'); sb.append(cookie); } } if (counter > 0) sb.append(';'); sb.append(name).append('=').append(value); return sb.toString(); }  static String setCookie(String cookieHeader, String name, String value); static String removeCookie(String cookieHeader, String name);  }### Answer:
@Test public void testSetCookie() { assertEquals("a=bc", CookieUtil.setCookie(null, "a", "bc")); assertEquals("a=bc", CookieUtil.setCookie("", "a", "bc")); assertEquals("a=1;b=2;c=4", CookieUtil.setCookie("a=1;c=3;b=2", "c", "4")); assertEquals("name=value", CookieUtil.setCookie(";", "name", "value")); assertEquals("name=value", CookieUtil.setCookie(";;;", "name", "value")); assertEquals("a=1;b=2;null=null", CookieUtil.setCookie("a=1;b=2", null, null)); }