01: package org.acegisecurity.ui.savedrequest;
02:
03: import junit.framework.TestCase;
04:
05: import javax.servlet.http.Cookie;
06: import java.io.Serializable;
07:
08: public class SavedCookieTests extends TestCase {
09:
10: Cookie cookie;
11: SavedCookie savedCookie;
12:
13: protected void setUp() throws Exception {
14: cookie = new Cookie("name", "value");
15: cookie.setComment("comment");
16: cookie.setDomain("domain");
17: cookie.setMaxAge(100);
18: cookie.setPath("path");
19: cookie.setSecure(true);
20: cookie.setVersion(11);
21: savedCookie = new SavedCookie(cookie);
22: }
23:
24: public void testGetName() throws Exception {
25: assertEquals(cookie.getName(), savedCookie.getName());
26: }
27:
28: public void testGetValue() throws Exception {
29: assertEquals(cookie.getValue(), savedCookie.getValue());
30: }
31:
32: public void testGetComment() throws Exception {
33: assertEquals(cookie.getComment(), savedCookie.getComment());
34: }
35:
36: public void testGetDomain() throws Exception {
37: assertEquals(cookie.getDomain(), savedCookie.getDomain());
38: }
39:
40: public void testGetMaxAge() throws Exception {
41: assertEquals(cookie.getMaxAge(), savedCookie.getMaxAge());
42: }
43:
44: public void testGetPath() throws Exception {
45: assertEquals(cookie.getPath(), savedCookie.getPath());
46: }
47:
48: public void testGetVersion() throws Exception {
49: assertEquals(cookie.getVersion(), savedCookie.getVersion());
50: }
51:
52: public void testGetCookie() throws Exception {
53: Cookie other = savedCookie.getCookie();
54: assertEquals(cookie.getComment(), other.getComment());
55: assertEquals(cookie.getDomain(), other.getDomain());
56: assertEquals(cookie.getMaxAge(), other.getMaxAge());
57: assertEquals(cookie.getName(), other.getName());
58: assertEquals(cookie.getPath(), other.getPath());
59: assertEquals(cookie.getSecure(), other.getSecure());
60: assertEquals(cookie.getValue(), other.getValue());
61: assertEquals(cookie.getVersion(), other.getVersion());
62: }
63:
64: public void testSerializable() throws Exception {
65: assertTrue(savedCookie instanceof Serializable);
66: }
67: }
|