• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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.phone.vvm.omtp;
18 
19 import android.os.Bundle;
20 
21 import com.android.internal.annotations.VisibleForTesting;
22 import com.android.phone.vvm.omtp.sms.StatusMessage;
23 
24 import junit.framework.TestCase;
25 
26 @VisibleForTesting
27 public class StatusMessageTest extends TestCase {
28 
testStatusMessage()29     public void testStatusMessage() {
30         Bundle bundle = new Bundle();
31         bundle.putString(OmtpConstants.PROVISIONING_STATUS, "status");
32         bundle.putString(OmtpConstants.RETURN_CODE, "code");
33         bundle.putString(OmtpConstants.SUBSCRIPTION_URL, "url");
34         bundle.putString(OmtpConstants.SERVER_ADDRESS, "address");
35         bundle.putString(OmtpConstants.TUI_ACCESS_NUMBER, "tui");
36         bundle.putString(OmtpConstants.CLIENT_SMS_DESTINATION_NUMBER, "sms");
37         bundle.putString(OmtpConstants.IMAP_PORT, "1234");
38         bundle.putString(OmtpConstants.IMAP_USER_NAME, "username");
39         bundle.putString(OmtpConstants.IMAP_PASSWORD, "password");
40         bundle.putString(OmtpConstants.SMTP_PORT, "s1234");
41         bundle.putString(OmtpConstants.SMTP_USER_NAME, "susername");
42         bundle.putString(OmtpConstants.SMTP_PASSWORD, "spassword");
43         bundle.putString(OmtpConstants.TUI_PASSWORD_LENGTH, "4-7");
44 
45         StatusMessage message = new StatusMessage(bundle);
46         assertEquals("status", message.getProvisioningStatus());
47         assertEquals("code", message.getReturnCode());
48         assertEquals("url", message.getSubscriptionUrl());
49         assertEquals("address", message.getServerAddress());
50         assertEquals("tui", message.getTuiAccessNumber());
51         assertEquals("sms", message.getClientSmsDestinationNumber());
52         assertEquals("1234", message.getImapPort());
53         assertEquals("username", message.getImapUserName());
54         assertEquals("password", message.getImapPassword());
55         assertEquals("s1234", message.getSmtpPort());
56         assertEquals("susername", message.getSmtpUserName());
57         assertEquals("spassword", message.getSmtpPassword());
58         assertEquals("4-7", message.getTuiPasswordLength());
59     }
60 
testSyncMessage_EmptyBundle()61     public void testSyncMessage_EmptyBundle() {
62         StatusMessage message = new StatusMessage(new Bundle());
63         assertEquals("", message.getProvisioningStatus());
64         assertEquals("", message.getReturnCode());
65         assertEquals("", message.getSubscriptionUrl());
66         assertEquals("", message.getServerAddress());
67         assertEquals("", message.getTuiAccessNumber());
68         assertEquals("", message.getClientSmsDestinationNumber());
69         assertEquals("", message.getImapPort());
70         assertEquals("", message.getImapUserName());
71         assertEquals("", message.getImapPassword());
72         assertEquals("", message.getSmtpPort());
73         assertEquals("", message.getSmtpUserName());
74         assertEquals("", message.getSmtpPassword());
75         assertEquals("", message.getTuiPasswordLength());
76     }
77 }
78