• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.exchange;
18 
19 import com.android.emailcommon.provider.EmailContent.Attachment;
20 
21 import android.test.AndroidTestCase;
22 
23 /**
24  * You can run this entire test case with:
25  *   runtest -c com.android.exchange.RequestTests exchange
26  */
27 public class RequestTests extends AndroidTestCase {
28 
testPartRequestEquals()29     public void testPartRequestEquals() {
30         Attachment att1 = new Attachment();
31         att1.mId = 1;
32         Attachment att2 = new Attachment();
33         att2.mId = 2;
34         // For part requests, the attachment id's must be ==
35         PartRequest req1 = new PartRequest(att1, "dest1", "content1");
36         PartRequest req2 = new PartRequest(att2, "dest2", "content2");
37         assertFalse(req1.equals(req2));
38         Attachment att3 = new Attachment();
39         att3.mId = 1;
40         PartRequest req3 = new PartRequest(att3, "dest3", "content3");
41         assertTrue(req1.equals(req3));
42         MessageMoveRequest req4 = new MessageMoveRequest(10L, 12L);
43         assertFalse(req1.equals(req4));
44     }
45 
testRequestEquals()46     public void testRequestEquals() {
47         // Only the messageId needs to be ==
48         MessageMoveRequest req1 = new MessageMoveRequest(1L, 10L);
49         MessageMoveRequest req2 = new MessageMoveRequest(1L, 11L);
50         assertTrue(req1.equals(req2));
51         MessageMoveRequest req3 = new MessageMoveRequest(2L, 11L);
52         assertFalse(req3.equals(req2));
53         MeetingResponseRequest req4 = new MeetingResponseRequest(1L, 3);
54         assertFalse(req4.equals(req1));
55         MeetingResponseRequest req5 = new MeetingResponseRequest(1L, 4);
56         assertTrue(req5.equals(req4));
57     }
58 }