01: package com.sun.portal.wireless.tests.jsp;
02:
03: import java.net.*;
04: import java.util.*;
05: import junit.framework.*;
06: import com.sun.portal.wireless.tests.*;
07:
08: public class TestLaunchMail extends TestCase {
09: private static final String BASEDIR = "src/com/sun/portal/wireless/tests/jsp";
10:
11: public void testGet() {
12: doGet(new UPSDK41(), "testGet");
13: }
14:
15: public void testGetNokia6310i() {
16: doGet(new Nokia6310i(), "testGetNokia6310i");
17: }
18:
19: private void doGet(Device device, String method) {
20: try {
21: // set up the connection
22: ClientSession sess = new ClientSession(device);
23: sess.getDesktop();
24:
25: // go to launchMail.jsp
26: String path = "portal/jsp/default/launchMail.jsp";
27: HashMap params = new HashMap();
28: params.put("mi", "sunOneMail");
29: sess.doGet(path, params);
30:
31: HttpURLConnection conn = sess.getConnection();
32: assertEquals(200, conn.getResponseCode());
33:
34: // check the result against reference files
35: String result = TestUtils.getString(conn.getInputStream());
36: String expected = BASEDIR + "/expected/TestLaunchMail."
37: + method;
38: String unexpected = BASEDIR + "/unexpected/TestLaunchMail."
39: + method;
40: Compare comp = new Compare(this );
41: comp.check(result, expected, unexpected);
42:
43: sess.logout();
44:
45: } catch (Exception e) {
46: TestUtils.fail(this, e);
47: }
48: }
49:
50: }
|