use of android.telephony.CellIdentityGsm in project android_frameworks_opt_telephony by LineageOS.
the class CellIdentityGsmTest method testgetGlobalCellId.
@SmallTest
public void testgetGlobalCellId() {
CellIdentityGsm ci = new CellIdentityGsm(LAC + 1, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
assertNull(ci.getGlobalCellId());
ci = new CellIdentityGsm(LAC, CID + 1, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
assertNull(ci.getGlobalCellId());
ci = new CellIdentityGsm(LAC, -1, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
assertNull(ci.getGlobalCellId());
// Test id with one digit and corresponding zero padding
int cid = 1;
ci = new CellIdentityGsm(LAC, cid, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
String globalCi = MCC_STR + MNC_STR + Integer.toString(LAC, 16) + "000" + Integer.toString(cid, 16);
assertEquals(globalCi, ci.getGlobalCellId());
}
use of android.telephony.CellIdentityGsm in project android_frameworks_opt_telephony by LineageOS.
the class CellIdentityGsmTest method testConstructorWithThreeDigitMnc.
@SmallTest
public void testConstructorWithThreeDigitMnc() {
final String mncWithThreeDigit = "061";
CellIdentityGsm ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, mncWithThreeDigit, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
assertEquals(MCC, ci.getMcc());
assertEquals(61, ci.getMnc());
assertEquals(MCC_STR, ci.getMccString());
assertEquals(mncWithThreeDigit, ci.getMncString());
assertEquals(MCC_STR + mncWithThreeDigit, ci.getMobileNetworkOperator());
String globalCi = MCC_STR + mncWithThreeDigit + Integer.toString(LAC, 16) + Integer.toString(CID, 16);
assertEquals(globalCi, ci.getGlobalCellId());
}
use of android.telephony.CellIdentityGsm in project android_frameworks_opt_telephony by LineageOS.
the class CellIdentityGsmTest method testEquals.
@SmallTest
public void testEquals() {
CellIdentityGsm ciA = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
CellIdentityGsm ciB = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
assertTrue(ciA.equals(ciB));
ciA = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
ciB = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
assertTrue(ciA.equals(ciB));
ciA = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
ciB = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
assertFalse(ciA.equals(ciB));
}
Aggregations