• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 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 android.test.suitebuilder.annotation.MediumTest;
20 
21 import com.android.emailcommon.provider.Mailbox;
22 import com.android.exchange.EasOutboxService.OriginalMessageInfo;
23 import com.android.exchange.utility.ExchangeTestCase;
24 
25 /**
26  * You can run this entire test case with:
27  *   runtest -c com.android.exchange.EasOutboxServiceTests exchange
28  */
29 @MediumTest
30 public class EasOutboxServiceTests extends ExchangeTestCase {
31 
testGenerateSmartSendCmd()32     public void testGenerateSmartSendCmd() {
33         EasOutboxService svc = new EasOutboxService(mProviderContext, new Mailbox());
34         // Test encoding of collection id; colon should be preserved
35         OriginalMessageInfo info = new OriginalMessageInfo("1339085683659694034", "Mail:^f", null);
36         String cmd = svc.generateSmartSendCmd(true, info);
37         assertEquals("SmartReply&ItemId=1339085683659694034&CollectionId=Mail:%5Ef", cmd);
38         // Test encoding of item id
39         info = new OriginalMessageInfo("14:&3", "6", null);
40         cmd = svc.generateSmartSendCmd(false, info);
41         assertEquals("SmartForward&ItemId=14:%263&CollectionId=6", cmd);
42         // Test use of long id
43         info = new OriginalMessageInfo("1339085683659694034", "Mail:^f", "3232323AAA");
44         cmd = svc.generateSmartSendCmd(false, info);
45         assertEquals("SmartForward&LongId=3232323AAA", cmd);
46     }
47 }
48