Loading tests/telephonytests/src/com/android/internal/telephony/CellIdentityCdmaTest.java 0 → 100644 +94 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; import static org.junit.Assert.assertEquals; import android.os.Parcel; import android.telephony.CellIdentityCdma; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; /** Unit tests for {@link CellIdentityCdma}. */ public class CellIdentityCdmaTest extends AndroidTestCase { // Network Id ranges from 0 to 65535. private static final int NETWORK_ID = 65535; // CDMA System Id ranges from 0 to 32767 private static final int SYSTEM_ID = 32767; // Base Station Id ranges from 0 to 65535 private static final int BASESTATION_ID = 65535; // Longitude ranges from -2592000 to 2592000. private static final int LONGITUDE = 2592000; // Latitude ranges from -1296000 to 1296000. private static final int LATITUDE = 1296000; private static final String ALPHA_LONG = "long"; private static final String ALPHA_SHORT = "short"; @SmallTest public void testConstructor() { CellIdentityCdma ci = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT); assertEquals(NETWORK_ID, ci.getNetworkId()); assertEquals(LATITUDE, ci.getLatitude()); assertEquals(ALPHA_LONG, ci.getOperatorAlphaLong()); assertEquals(ALPHA_SHORT, ci.getOperatorAlphaShort()); } @SmallTest public void testEquals() { CellIdentityCdma ciA = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT); CellIdentityCdma ciB = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT); assertTrue(ciA.equals(ciB)); ciA = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, null, null); ciB = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, null, null); assertTrue(ciA.equals(ciB)); ciA = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT); ciB = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, null, null); assertFalse(ciA.equals(ciB)); } @SmallTest public void testParcel() { CellIdentityCdma ci = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT); Parcel p = Parcel.obtain(); ci.writeToParcel(p, 0); p.setDataPosition(0); CellIdentityCdma newCi = CellIdentityCdma.CREATOR.createFromParcel(p); assertEquals(ci, newCi); } } tests/telephonytests/src/com/android/internal/telephony/CellIdentityGsmTest.java 0 → 100644 +175 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import android.os.Parcel; import android.telephony.CellIdentityGsm; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; /** Unit tests for {@link CellIdentityGsm}. */ public class CellIdentityGsmTest extends AndroidTestCase { // Location Area Code ranges from 0 to 65535. private static final int LAC = 65535; // GSM Cell Identity ranges from 0 to 65535. private static final int CID = 65535; // GSM Absolute RF Channel Number ranges from 0 to 65535. private static final int ARFCN = 65535; // Base Station Identity Code ranges from 0 to 63. private static final int BSIC = 63; private static final int MCC = 120; private static final int MNC = 260; private static final String MCC_STR = "120"; private static final String MNC_STR = "260"; private static final String ALPHA_LONG = "long"; private static final String ALPHA_SHORT = "short"; @SmallTest public void testDefaultConstructor() { CellIdentityGsm ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); assertEquals(LAC, ci.getLac()); assertEquals(CID, ci.getCid()); assertEquals(ARFCN, ci.getArfcn()); assertEquals(BSIC, ci.getBsic()); assertEquals(MCC, ci.getMcc()); assertEquals(MNC, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(MNC_STR, ci.getMncStr()); assertEquals(MCC_STR + MNC_STR, ci.getMobileNetworkOperator()); assertEquals(ALPHA_LONG, ci.getOperatorAlphaLong()); assertEquals(ALPHA_SHORT, ci.getOperatorAlphaShort()); } @SmallTest public void testConstructorWithThreeDigitMnc() { final String mncWithThreeDigit = "061"; CellIdentityGsm ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, mncWithThreeDigit, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(61, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(mncWithThreeDigit, ci.getMncStr()); assertEquals(MCC_STR + mncWithThreeDigit, ci.getMobileNetworkOperator()); } @SmallTest public void testConstructorWithTwoDigitMnc() { final String mncWithTwoDigit = "61"; CellIdentityGsm ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, mncWithTwoDigit, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(61, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(mncWithTwoDigit, ci.getMncStr()); assertEquals(MCC_STR + mncWithTwoDigit, ci.getMobileNetworkOperator()); } @SmallTest public void testConstructorWithEmptyMccMnc() { CellIdentityGsm ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, null, ALPHA_LONG, ALPHA_SHORT); assertEquals(Integer.MAX_VALUE, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(null, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, "", "", ALPHA_LONG, ALPHA_SHORT); assertEquals(Integer.MAX_VALUE, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(null, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); } @SmallTest public void testFormerConstructor() { CellIdentityGsm ci = new CellIdentityGsm(MCC, MNC, LAC, CID); assertEquals(LAC, ci.getLac()); assertEquals(CID, ci.getCid()); assertEquals(Integer.MAX_VALUE, ci.getArfcn()); assertEquals(Integer.MAX_VALUE, ci.getBsic()); assertEquals(MCC, ci.getMcc()); assertEquals(MNC, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(MNC_STR, ci.getMncStr()); assertEquals(MCC_STR + MNC_STR, ci.getMobileNetworkOperator()); assertNull(ci.getOperatorAlphaLong()); assertNull(ci.getOperatorAlphaShort()); } @SmallTest public void testEquals() { CellIdentityGsm ciA = new CellIdentityGsm( LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); CellIdentityGsm ciB = new CellIdentityGsm( LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); assertTrue(ciA.equals(ciB)); ciA = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT); ciB = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT); assertTrue(ciA.equals(ciB)); ciA = new CellIdentityGsm( LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); ciB = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT); assertFalse(ciA.equals(ciB)); } @SmallTest public void testParcel() { CellIdentityGsm ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); Parcel p = Parcel.obtain(); ci.writeToParcel(p, 0); p.setDataPosition(0); CellIdentityGsm newCi = CellIdentityGsm.CREATOR.createFromParcel(p); assertEquals(ci, newCi); } } tests/telephonytests/src/com/android/internal/telephony/CellIdentityLteTest.java 0 → 100644 +171 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; import static org.junit.Assert.assertEquals; import android.os.Parcel; import android.telephony.CellIdentityLte; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; /** Unit tests for {@link CellIdentityLte}. */ public class CellIdentityLteTest extends AndroidTestCase { // Cell identity ranges from 0 to 268435456. private static final int CI = 268435456; // Physical cell id ranges from 0 to 503. private static final int PCI = 503; // Tracking area code ranges from 0 to 65535. private static final int TAC = 65535; // Absolute RF Channel Number ranges from 0 to 262140. private static final int EARFCN = 262140; private static final int MCC = 120; private static final int MNC = 260; private static final String MCC_STR = "120"; private static final String MNC_STR = "260"; private static final String ALPHA_LONG = "long"; private static final String ALPHA_SHORT = "short"; @SmallTest public void testDefaultConstructor() { CellIdentityLte ci = new CellIdentityLte(CI, PCI, TAC, EARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); assertEquals(CI, ci.getCi()); assertEquals(PCI, ci.getPci()); assertEquals(TAC, ci.getTac()); assertEquals(EARFCN, ci.getEarfcn()); assertEquals(MCC, ci.getMcc()); assertEquals(MNC, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(MNC_STR, ci.getMncStr()); assertEquals(MCC_STR + MNC_STR, ci.getMobileNetworkOperator()); assertEquals(ALPHA_LONG, ci.getOperatorAlphaLong()); assertEquals(ALPHA_SHORT, ci.getOperatorAlphaShort()); } @SmallTest public void testConstructorWithThreeDigitMnc() { final String mncWithThreeDigit = "061"; CellIdentityLte ci = new CellIdentityLte(CI, PCI, TAC, EARFCN, MCC_STR, mncWithThreeDigit, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(61, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(mncWithThreeDigit, ci.getMncStr()); assertEquals(MCC_STR + mncWithThreeDigit, ci.getMobileNetworkOperator()); } @SmallTest public void testConstructorWithTwoDigitMnc() { final String mncWithTwoDigit = "61"; CellIdentityLte ci = new CellIdentityLte(CI, PCI, TAC, EARFCN, MCC_STR, mncWithTwoDigit, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(61, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(mncWithTwoDigit, ci.getMncStr()); assertEquals(MCC_STR + mncWithTwoDigit, ci.getMobileNetworkOperator()); } @SmallTest public void testConstructorWithEmptyMccMnc() { CellIdentityLte ci = new CellIdentityLte(CI, PCI, TAC, EARFCN, null, null, ALPHA_LONG, ALPHA_SHORT); assertEquals(Integer.MAX_VALUE, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(null, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); ci = new CellIdentityLte(CI, PCI, TAC, EARFCN, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); ci = new CellIdentityLte(CI, PCI, TAC, EARFCN, "", "", ALPHA_LONG, ALPHA_SHORT); assertEquals(Integer.MAX_VALUE, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(null, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); } @SmallTest public void testFormerConstructor() { CellIdentityLte ci = new CellIdentityLte(MCC, MNC, CI, PCI, TAC); assertEquals(CI, ci.getCi()); assertEquals(PCI, ci.getPci()); assertEquals(TAC, ci.getTac()); assertEquals(Integer.MAX_VALUE, ci.getEarfcn()); assertEquals(MCC, ci.getMcc()); assertEquals(MNC, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(MNC_STR, ci.getMncStr()); assertEquals(MCC_STR + MNC_STR, ci.getMobileNetworkOperator()); assertNull(ci.getOperatorAlphaLong()); assertNull(ci.getOperatorAlphaShort()); } @SmallTest public void testEquals() { CellIdentityLte ciA = new CellIdentityLte( CI, PCI, TAC, EARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); CellIdentityLte ciB = new CellIdentityLte( CI, PCI, TAC, EARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); assertTrue(ciA.equals(ciB)); ciA = new CellIdentityLte(CI, PCI, TAC, EARFCN, null, null, ALPHA_LONG, ALPHA_SHORT); ciB = new CellIdentityLte(CI, PCI, TAC, EARFCN, null, null, ALPHA_LONG, ALPHA_SHORT); assertTrue(ciA.equals(ciB)); ciA = new CellIdentityLte(CI, PCI, TAC, EARFCN, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT); ciB = new CellIdentityLte(CI, PCI, TAC, EARFCN, null, null, ALPHA_LONG, ALPHA_SHORT); assertFalse(ciA.equals(ciB)); } @SmallTest public void testParcel() { CellIdentityLte ci = new CellIdentityLte(CI, PCI, TAC, EARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); Parcel p = Parcel.obtain(); ci.writeToParcel(p, 0); p.setDataPosition(0); CellIdentityLte newCi = CellIdentityLte.CREATOR.createFromParcel(p); assertEquals(ci, newCi); } } tests/telephonytests/src/com/android/internal/telephony/CellIdentityWcdmaTest.java 0 → 100644 +170 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; import static org.junit.Assert.assertEquals; import android.os.Parcel; import android.telephony.CellIdentityWcdma; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; /** Unit tests for {@link CellIdentityWcdma}. */ public class CellIdentityWcdmaTest extends AndroidTestCase { // Location Area Code ranges from 0 to 65535. private static final int LAC = 65535; // UMTS Cell Identity ranges from 0 to 268435455. private static final int CID = 268435455; // Primary Scrambling Coderanges from 0 to 511. private static final int PSC = 511; // UMTS Absolute RF Channel Number ranges from 0 to 65535. private static final int UARFCN = 65535; private static final int MCC = 120; private static final int MNC = 260; private static final String MCC_STR = "120"; private static final String MNC_STR = "260"; private static final String ALPHA_LONG = "long"; private static final String ALPHA_SHORT = "short"; @SmallTest public void testDefaultConstructor() { CellIdentityWcdma ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); assertEquals(LAC, ci.getLac()); assertEquals(CID, ci.getCid()); assertEquals(PSC, ci.getPsc()); assertEquals(MCC, ci.getMcc()); assertEquals(MNC, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(MNC_STR, ci.getMncStr()); assertEquals(MCC_STR + MNC_STR, ci.getMobileNetworkOperator()); assertEquals(ALPHA_LONG, ci.getOperatorAlphaLong()); assertEquals(ALPHA_SHORT, ci.getOperatorAlphaShort()); } @SmallTest public void testConstructorWithThreeDigitMnc() { final String mncWithThreeDigit = "061"; CellIdentityWcdma ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, mncWithThreeDigit, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(61, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(mncWithThreeDigit, ci.getMncStr()); assertEquals(MCC_STR + mncWithThreeDigit, ci.getMobileNetworkOperator()); } @SmallTest public void testConstructorWithTwoDigitMnc() { final String mncWithTwoDigit = "61"; CellIdentityWcdma ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, mncWithTwoDigit, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(61, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(mncWithTwoDigit, ci.getMncStr()); assertEquals(MCC_STR + mncWithTwoDigit, ci.getMobileNetworkOperator()); } @SmallTest public void testConstructorWithEmptyMccMnc() { final String integerMaxValue = String.valueOf(Integer.MAX_VALUE); CellIdentityWcdma ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT); assertEquals(Integer.MAX_VALUE, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(null, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, "", "", ALPHA_LONG, ALPHA_SHORT); assertEquals(Integer.MAX_VALUE, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(null, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); } @SmallTest public void testFormerConstructor() { CellIdentityWcdma ci = new CellIdentityWcdma(MCC, MNC, LAC, CID, PSC); assertEquals(LAC, ci.getLac()); assertEquals(CID, ci.getCid()); assertEquals(PSC, ci.getPsc()); assertEquals(MCC, ci.getMcc()); assertEquals(MNC, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(MNC_STR, ci.getMncStr()); assertEquals(MCC_STR + MNC_STR, ci.getMobileNetworkOperator()); assertNull(ci.getOperatorAlphaLong()); assertNull(ci.getOperatorAlphaShort()); } @SmallTest public void testEquals() { CellIdentityWcdma ciA = new CellIdentityWcdma( LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); CellIdentityWcdma ciB = new CellIdentityWcdma( LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); assertTrue(ciA.equals(ciB)); ciA = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT); ciB = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT); assertTrue(ciA.equals(ciB)); ciA = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT); ciB = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT); assertFalse(ciA.equals(ciB)); } @SmallTest public void testParcel() { CellIdentityWcdma ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); Parcel p = Parcel.obtain(); ci.writeToParcel(p, 0); p.setDataPosition(0); CellIdentityWcdma newCi = CellIdentityWcdma.CREATOR.createFromParcel(p); assertEquals(ci, newCi); } } Loading
tests/telephonytests/src/com/android/internal/telephony/CellIdentityCdmaTest.java 0 → 100644 +94 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; import static org.junit.Assert.assertEquals; import android.os.Parcel; import android.telephony.CellIdentityCdma; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; /** Unit tests for {@link CellIdentityCdma}. */ public class CellIdentityCdmaTest extends AndroidTestCase { // Network Id ranges from 0 to 65535. private static final int NETWORK_ID = 65535; // CDMA System Id ranges from 0 to 32767 private static final int SYSTEM_ID = 32767; // Base Station Id ranges from 0 to 65535 private static final int BASESTATION_ID = 65535; // Longitude ranges from -2592000 to 2592000. private static final int LONGITUDE = 2592000; // Latitude ranges from -1296000 to 1296000. private static final int LATITUDE = 1296000; private static final String ALPHA_LONG = "long"; private static final String ALPHA_SHORT = "short"; @SmallTest public void testConstructor() { CellIdentityCdma ci = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT); assertEquals(NETWORK_ID, ci.getNetworkId()); assertEquals(LATITUDE, ci.getLatitude()); assertEquals(ALPHA_LONG, ci.getOperatorAlphaLong()); assertEquals(ALPHA_SHORT, ci.getOperatorAlphaShort()); } @SmallTest public void testEquals() { CellIdentityCdma ciA = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT); CellIdentityCdma ciB = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT); assertTrue(ciA.equals(ciB)); ciA = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, null, null); ciB = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, null, null); assertTrue(ciA.equals(ciB)); ciA = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT); ciB = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, null, null); assertFalse(ciA.equals(ciB)); } @SmallTest public void testParcel() { CellIdentityCdma ci = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT); Parcel p = Parcel.obtain(); ci.writeToParcel(p, 0); p.setDataPosition(0); CellIdentityCdma newCi = CellIdentityCdma.CREATOR.createFromParcel(p); assertEquals(ci, newCi); } }
tests/telephonytests/src/com/android/internal/telephony/CellIdentityGsmTest.java 0 → 100644 +175 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import android.os.Parcel; import android.telephony.CellIdentityGsm; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; /** Unit tests for {@link CellIdentityGsm}. */ public class CellIdentityGsmTest extends AndroidTestCase { // Location Area Code ranges from 0 to 65535. private static final int LAC = 65535; // GSM Cell Identity ranges from 0 to 65535. private static final int CID = 65535; // GSM Absolute RF Channel Number ranges from 0 to 65535. private static final int ARFCN = 65535; // Base Station Identity Code ranges from 0 to 63. private static final int BSIC = 63; private static final int MCC = 120; private static final int MNC = 260; private static final String MCC_STR = "120"; private static final String MNC_STR = "260"; private static final String ALPHA_LONG = "long"; private static final String ALPHA_SHORT = "short"; @SmallTest public void testDefaultConstructor() { CellIdentityGsm ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); assertEquals(LAC, ci.getLac()); assertEquals(CID, ci.getCid()); assertEquals(ARFCN, ci.getArfcn()); assertEquals(BSIC, ci.getBsic()); assertEquals(MCC, ci.getMcc()); assertEquals(MNC, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(MNC_STR, ci.getMncStr()); assertEquals(MCC_STR + MNC_STR, ci.getMobileNetworkOperator()); assertEquals(ALPHA_LONG, ci.getOperatorAlphaLong()); assertEquals(ALPHA_SHORT, ci.getOperatorAlphaShort()); } @SmallTest public void testConstructorWithThreeDigitMnc() { final String mncWithThreeDigit = "061"; CellIdentityGsm ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, mncWithThreeDigit, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(61, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(mncWithThreeDigit, ci.getMncStr()); assertEquals(MCC_STR + mncWithThreeDigit, ci.getMobileNetworkOperator()); } @SmallTest public void testConstructorWithTwoDigitMnc() { final String mncWithTwoDigit = "61"; CellIdentityGsm ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, mncWithTwoDigit, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(61, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(mncWithTwoDigit, ci.getMncStr()); assertEquals(MCC_STR + mncWithTwoDigit, ci.getMobileNetworkOperator()); } @SmallTest public void testConstructorWithEmptyMccMnc() { CellIdentityGsm ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, null, ALPHA_LONG, ALPHA_SHORT); assertEquals(Integer.MAX_VALUE, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(null, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, "", "", ALPHA_LONG, ALPHA_SHORT); assertEquals(Integer.MAX_VALUE, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(null, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); } @SmallTest public void testFormerConstructor() { CellIdentityGsm ci = new CellIdentityGsm(MCC, MNC, LAC, CID); assertEquals(LAC, ci.getLac()); assertEquals(CID, ci.getCid()); assertEquals(Integer.MAX_VALUE, ci.getArfcn()); assertEquals(Integer.MAX_VALUE, ci.getBsic()); assertEquals(MCC, ci.getMcc()); assertEquals(MNC, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(MNC_STR, ci.getMncStr()); assertEquals(MCC_STR + MNC_STR, ci.getMobileNetworkOperator()); assertNull(ci.getOperatorAlphaLong()); assertNull(ci.getOperatorAlphaShort()); } @SmallTest public void testEquals() { CellIdentityGsm ciA = new CellIdentityGsm( LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); CellIdentityGsm ciB = new CellIdentityGsm( LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); assertTrue(ciA.equals(ciB)); ciA = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT); ciB = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT); assertTrue(ciA.equals(ciB)); ciA = new CellIdentityGsm( LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); ciB = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT); assertFalse(ciA.equals(ciB)); } @SmallTest public void testParcel() { CellIdentityGsm ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); Parcel p = Parcel.obtain(); ci.writeToParcel(p, 0); p.setDataPosition(0); CellIdentityGsm newCi = CellIdentityGsm.CREATOR.createFromParcel(p); assertEquals(ci, newCi); } }
tests/telephonytests/src/com/android/internal/telephony/CellIdentityLteTest.java 0 → 100644 +171 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; import static org.junit.Assert.assertEquals; import android.os.Parcel; import android.telephony.CellIdentityLte; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; /** Unit tests for {@link CellIdentityLte}. */ public class CellIdentityLteTest extends AndroidTestCase { // Cell identity ranges from 0 to 268435456. private static final int CI = 268435456; // Physical cell id ranges from 0 to 503. private static final int PCI = 503; // Tracking area code ranges from 0 to 65535. private static final int TAC = 65535; // Absolute RF Channel Number ranges from 0 to 262140. private static final int EARFCN = 262140; private static final int MCC = 120; private static final int MNC = 260; private static final String MCC_STR = "120"; private static final String MNC_STR = "260"; private static final String ALPHA_LONG = "long"; private static final String ALPHA_SHORT = "short"; @SmallTest public void testDefaultConstructor() { CellIdentityLte ci = new CellIdentityLte(CI, PCI, TAC, EARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); assertEquals(CI, ci.getCi()); assertEquals(PCI, ci.getPci()); assertEquals(TAC, ci.getTac()); assertEquals(EARFCN, ci.getEarfcn()); assertEquals(MCC, ci.getMcc()); assertEquals(MNC, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(MNC_STR, ci.getMncStr()); assertEquals(MCC_STR + MNC_STR, ci.getMobileNetworkOperator()); assertEquals(ALPHA_LONG, ci.getOperatorAlphaLong()); assertEquals(ALPHA_SHORT, ci.getOperatorAlphaShort()); } @SmallTest public void testConstructorWithThreeDigitMnc() { final String mncWithThreeDigit = "061"; CellIdentityLte ci = new CellIdentityLte(CI, PCI, TAC, EARFCN, MCC_STR, mncWithThreeDigit, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(61, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(mncWithThreeDigit, ci.getMncStr()); assertEquals(MCC_STR + mncWithThreeDigit, ci.getMobileNetworkOperator()); } @SmallTest public void testConstructorWithTwoDigitMnc() { final String mncWithTwoDigit = "61"; CellIdentityLte ci = new CellIdentityLte(CI, PCI, TAC, EARFCN, MCC_STR, mncWithTwoDigit, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(61, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(mncWithTwoDigit, ci.getMncStr()); assertEquals(MCC_STR + mncWithTwoDigit, ci.getMobileNetworkOperator()); } @SmallTest public void testConstructorWithEmptyMccMnc() { CellIdentityLte ci = new CellIdentityLte(CI, PCI, TAC, EARFCN, null, null, ALPHA_LONG, ALPHA_SHORT); assertEquals(Integer.MAX_VALUE, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(null, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); ci = new CellIdentityLte(CI, PCI, TAC, EARFCN, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); ci = new CellIdentityLte(CI, PCI, TAC, EARFCN, "", "", ALPHA_LONG, ALPHA_SHORT); assertEquals(Integer.MAX_VALUE, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(null, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); } @SmallTest public void testFormerConstructor() { CellIdentityLte ci = new CellIdentityLte(MCC, MNC, CI, PCI, TAC); assertEquals(CI, ci.getCi()); assertEquals(PCI, ci.getPci()); assertEquals(TAC, ci.getTac()); assertEquals(Integer.MAX_VALUE, ci.getEarfcn()); assertEquals(MCC, ci.getMcc()); assertEquals(MNC, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(MNC_STR, ci.getMncStr()); assertEquals(MCC_STR + MNC_STR, ci.getMobileNetworkOperator()); assertNull(ci.getOperatorAlphaLong()); assertNull(ci.getOperatorAlphaShort()); } @SmallTest public void testEquals() { CellIdentityLte ciA = new CellIdentityLte( CI, PCI, TAC, EARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); CellIdentityLte ciB = new CellIdentityLte( CI, PCI, TAC, EARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); assertTrue(ciA.equals(ciB)); ciA = new CellIdentityLte(CI, PCI, TAC, EARFCN, null, null, ALPHA_LONG, ALPHA_SHORT); ciB = new CellIdentityLte(CI, PCI, TAC, EARFCN, null, null, ALPHA_LONG, ALPHA_SHORT); assertTrue(ciA.equals(ciB)); ciA = new CellIdentityLte(CI, PCI, TAC, EARFCN, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT); ciB = new CellIdentityLte(CI, PCI, TAC, EARFCN, null, null, ALPHA_LONG, ALPHA_SHORT); assertFalse(ciA.equals(ciB)); } @SmallTest public void testParcel() { CellIdentityLte ci = new CellIdentityLte(CI, PCI, TAC, EARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); Parcel p = Parcel.obtain(); ci.writeToParcel(p, 0); p.setDataPosition(0); CellIdentityLte newCi = CellIdentityLte.CREATOR.createFromParcel(p); assertEquals(ci, newCi); } }
tests/telephonytests/src/com/android/internal/telephony/CellIdentityWcdmaTest.java 0 → 100644 +170 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; import static org.junit.Assert.assertEquals; import android.os.Parcel; import android.telephony.CellIdentityWcdma; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; /** Unit tests for {@link CellIdentityWcdma}. */ public class CellIdentityWcdmaTest extends AndroidTestCase { // Location Area Code ranges from 0 to 65535. private static final int LAC = 65535; // UMTS Cell Identity ranges from 0 to 268435455. private static final int CID = 268435455; // Primary Scrambling Coderanges from 0 to 511. private static final int PSC = 511; // UMTS Absolute RF Channel Number ranges from 0 to 65535. private static final int UARFCN = 65535; private static final int MCC = 120; private static final int MNC = 260; private static final String MCC_STR = "120"; private static final String MNC_STR = "260"; private static final String ALPHA_LONG = "long"; private static final String ALPHA_SHORT = "short"; @SmallTest public void testDefaultConstructor() { CellIdentityWcdma ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); assertEquals(LAC, ci.getLac()); assertEquals(CID, ci.getCid()); assertEquals(PSC, ci.getPsc()); assertEquals(MCC, ci.getMcc()); assertEquals(MNC, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(MNC_STR, ci.getMncStr()); assertEquals(MCC_STR + MNC_STR, ci.getMobileNetworkOperator()); assertEquals(ALPHA_LONG, ci.getOperatorAlphaLong()); assertEquals(ALPHA_SHORT, ci.getOperatorAlphaShort()); } @SmallTest public void testConstructorWithThreeDigitMnc() { final String mncWithThreeDigit = "061"; CellIdentityWcdma ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, mncWithThreeDigit, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(61, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(mncWithThreeDigit, ci.getMncStr()); assertEquals(MCC_STR + mncWithThreeDigit, ci.getMobileNetworkOperator()); } @SmallTest public void testConstructorWithTwoDigitMnc() { final String mncWithTwoDigit = "61"; CellIdentityWcdma ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, mncWithTwoDigit, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(61, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(mncWithTwoDigit, ci.getMncStr()); assertEquals(MCC_STR + mncWithTwoDigit, ci.getMobileNetworkOperator()); } @SmallTest public void testConstructorWithEmptyMccMnc() { final String integerMaxValue = String.valueOf(Integer.MAX_VALUE); CellIdentityWcdma ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT); assertEquals(Integer.MAX_VALUE, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(null, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT); assertEquals(MCC, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, "", "", ALPHA_LONG, ALPHA_SHORT); assertEquals(Integer.MAX_VALUE, ci.getMcc()); assertEquals(Integer.MAX_VALUE, ci.getMnc()); assertEquals(null, ci.getMccStr()); assertEquals(null, ci.getMncStr()); assertEquals(null, ci.getMobileNetworkOperator()); } @SmallTest public void testFormerConstructor() { CellIdentityWcdma ci = new CellIdentityWcdma(MCC, MNC, LAC, CID, PSC); assertEquals(LAC, ci.getLac()); assertEquals(CID, ci.getCid()); assertEquals(PSC, ci.getPsc()); assertEquals(MCC, ci.getMcc()); assertEquals(MNC, ci.getMnc()); assertEquals(MCC_STR, ci.getMccStr()); assertEquals(MNC_STR, ci.getMncStr()); assertEquals(MCC_STR + MNC_STR, ci.getMobileNetworkOperator()); assertNull(ci.getOperatorAlphaLong()); assertNull(ci.getOperatorAlphaShort()); } @SmallTest public void testEquals() { CellIdentityWcdma ciA = new CellIdentityWcdma( LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); CellIdentityWcdma ciB = new CellIdentityWcdma( LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); assertTrue(ciA.equals(ciB)); ciA = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT); ciB = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT); assertTrue(ciA.equals(ciB)); ciA = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT); ciB = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT); assertFalse(ciA.equals(ciB)); } @SmallTest public void testParcel() { CellIdentityWcdma ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT); Parcel p = Parcel.obtain(); ci.writeToParcel(p, 0); p.setDataPosition(0); CellIdentityWcdma newCi = CellIdentityWcdma.CREATOR.createFromParcel(p); assertEquals(ci, newCi); } }