01: /*
02: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License version
07: * 2 only, as published by the Free Software Foundation.
08: *
09: * This program is distributed in the hope that it will be useful, but
10: * WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * General Public License version 2 for more details (a copy is
13: * included at /legal/license.txt).
14: *
15: * You should have received a copy of the GNU General Public License
16: * version 2 along with this work; if not, write to the Free Software
17: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18: * 02110-1301 USA
19: *
20: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
21: * Clara, CA 95054 or visit www.sun.com if you need additional
22: * information or have any questions.
23: */
24:
25: package com.sun.midp.jump.push.executive;
26:
27: import junit.framework.*;
28:
29: public class MIDPAppTest extends TestCase {
30: public MIDPAppTest(final String testName) {
31: super (testName);
32: }
33:
34: public void testCheckEqual() {
35: final MIDPApp app0 = new MIDPApp(239, "com.sun.Foo");
36: final MIDPApp app1 = new MIDPApp(239, "com.sun.Foo");
37:
38: assertTrue(app0.equals(app0));
39: assertTrue(app0.equals(app1));
40: assertTrue(app1.equals(app0));
41: assertTrue(app0.hashCode() == app1.hashCode());
42: }
43:
44: public void testCheckDifferentSuites() {
45: final int SUITE_ID_0 = 239;
46: final int SUITE_ID_1 = 139;
47: final String MIDLET = "com.sun.Foo";
48:
49: final MIDPApp app0 = new MIDPApp(SUITE_ID_0, MIDLET);
50: final MIDPApp app1 = new MIDPApp(SUITE_ID_1, MIDLET);
51:
52: assertFalse(app0.equals(app1));
53: assertFalse(app1.equals(app0));
54: assertFalse(app0.hashCode() == app1.hashCode());
55: }
56:
57: public void testCheckDifferentMidlets() {
58: final int SUITE_ID = 239;
59: final String MIDLET_0 = "com.sun.Foo";
60: final String MIDLET_1 = "com.sun.Bar";
61:
62: final MIDPApp app0 = new MIDPApp(SUITE_ID, MIDLET_0);
63: final MIDPApp app1 = new MIDPApp(SUITE_ID, MIDLET_1);
64:
65: assertFalse(app0.equals(app1));
66: assertFalse(app1.equals(app0));
67: assertFalse(app0.hashCode() == app1.hashCode());
68: }
69:
70: public void testCheckTotallyDifferent() {
71: final int SUITE_ID_0 = 239;
72: final int SUITE_ID_1 = 139;
73: final String MIDLET_0 = "com.sun.Foo";
74: final String MIDLET_1 = "com.sun.Bar";
75:
76: final MIDPApp app0 = new MIDPApp(SUITE_ID_0, MIDLET_0);
77: final MIDPApp app1 = new MIDPApp(SUITE_ID_1, MIDLET_1);
78:
79: assertFalse(app0.equals(app1));
80: assertFalse(app1.equals(app0));
81: assertFalse(app0.hashCode() == app1.hashCode());
82: }
83: }
|