### Question:
CookieHelper { public static String updatePropertyValue(String inCookieString, String propertyName, String newValue) { final String cookieString; if (inCookieString == null) { cookieString = net.violet.common.StringShop.EMPTY_STRING; } else { cookieString = inCookieString; } if (propertyName == null) { return cookieString; } final String theNewValue = (newValue == null) ? net.violet.common.StringShop.EMPTY_STRING : newValue; final StringTokenizer tokenList = new StringTokenizer(cookieString, ";"); final StringBuilder sbUpdatedCookie = new StringBuilder(cookieString.length() + 2); boolean updated = false; while (tokenList.hasMoreTokens()) { final String[] nameValuePair = tokenList.nextToken().split(":"); final String name = nameValuePair[0]; sbUpdatedCookie.append(name).append(":"); if (propertyName.equalsIgnoreCase(name)) { sbUpdatedCookie.append(theNewValue); updated = true; } else { sbUpdatedCookie.append(nameValuePair[1]); } sbUpdatedCookie.append(";"); } if (!updated) { sbUpdatedCookie.append(propertyName).append(":").append(theNewValue).append(";"); } return sbUpdatedCookie.toString(); }  static String getCookieString(Properties properties); static String getCookieString(Map<String, String> properties); static String getCookieString(String property, String value); static String getPropertyValue(String cookieString, String propertyName); static String updatePropertyValue(String inCookieString, String propertyName, String newValue);  }### Answer:
@Test public void testUpdatePropertyValue() { String strCookie = CookieHelper.updatePropertyValue(StringShop.EMPTY_STRING, "sn", "007"); strCookie = CookieHelper.updatePropertyValue(strCookie, "town", "napoli"); strCookie = CookieHelper.updatePropertyValue(strCookie, "planet", "venus"); Assert.assertEquals("sn:007;town:napoli;planet:venus;", strCookie); strCookie = CookieHelper.updatePropertyValue(strCookie, "PLANET", "mars"); Assert.assertEquals("sn:007;town:napoli;planet:mars;", strCookie); }