A simple class encapsulating a name/value pair.
9293949596979899
} public void testParseAttributeNullPath() throws Exception { CookieSpec cookiespec = new CookieSpecBase(); Cookie cookie = new Cookie(); cookiespec.parseAttribute(new NameValuePair("path", null), cookie); assertEquals("/", cookie.getPath()); }
99100101102103104105106
} public void testParseAttributeBlankPath() throws Exception { CookieSpec cookiespec = new CookieSpecBase(); Cookie cookie = new Cookie(); cookiespec.parseAttribute(new NameValuePair("path", " "), cookie); assertEquals("/", cookie.getPath()); }
107108109110111112113114115116
public void testParseAttributeNullDomain() throws Exception { CookieSpec cookiespec = new CookieSpecBase(); Cookie cookie = new Cookie(); try { cookiespec.parseAttribute(new NameValuePair("domain", null), cookie); fail("MalformedCookieException must have been thrown"); } catch (MalformedCookieException expected) { } }
117118119120121122123124125126
public void testParseAttributeBlankDomain() throws Exception { CookieSpec cookiespec = new CookieSpecBase(); Cookie cookie = new Cookie(); try { cookiespec.parseAttribute(new NameValuePair("domain", " "), cookie); fail("MalformedCookieException must have been thrown"); } catch (MalformedCookieException expected) { } }
127128129130131132133134135136
public void testParseAttributeNullMaxAge() throws Exception { CookieSpec cookiespec = new CookieSpecBase(); Cookie cookie = new Cookie(); try { cookiespec.parseAttribute(new NameValuePair("max-age", null), cookie); fail("MalformedCookieException must have been thrown"); } catch (MalformedCookieException expected) { } }
137138139140141142143144145146
public void testParseAttributeInvalidMaxAge() throws Exception { CookieSpec cookiespec = new CookieSpecBase(); Cookie cookie = new Cookie(); try { cookiespec.parseAttribute(new NameValuePair("max-age", "crap"), cookie); fail("MalformedCookieException must have been thrown"); } catch (MalformedCookieException expected) { } }
147148149150151152153154155156
public void testParseAttributeNullExpires() throws Exception { CookieSpec cookiespec = new CookieSpecBase(); Cookie cookie = new Cookie(); try { cookiespec.parseAttribute(new NameValuePair("expires", null), cookie); fail("MalformedCookieException must have been thrown"); } catch (MalformedCookieException expected) { } }
156157158159160161162
} public void testParseAttributeUnknownValue() throws Exception { CookieSpec cookiespec = new CookieSpecBase(); Cookie cookie = new Cookie(); cookiespec.parseAttribute(new NameValuePair("nonsense", null), cookie); }
70717273747576777879
} public void testParseAttributeInvalidCookie() throws Exception { CookieSpec cookiespec = new NetscapeDraftSpec(); try { cookiespec.parseAttribute(new NameValuePair("name", "value"), null); fail("IllegalArgumentException must have been thrown"); } catch (IllegalArgumentException expected) { } }
80818283848586878889
public void testParseAttributeInvalidCookieExpires() throws Exception { CookieSpec cookiespec = new NetscapeDraftSpec(); Cookie cookie = new Cookie(); try { cookiespec.parseAttribute(new NameValuePair("expires", null), cookie); fail("MalformedCookieException must have been thrown"); } catch (MalformedCookieException expected) { } }