use of android.telephony.CellIdentityNr in project android_frameworks_opt_telephony by LineageOS.
the class CellIdentityNrTest method testEquals_differentParameters.
@Test
public void testEquals_differentParameters() {
// GIVEN an instance of CellIdentityNr, and create another object with different parameters
CellIdentityNr cellIdentityNr = new CellIdentityNr(PCI, TAC, NRARFCN, BANDS, MCC_STR, MNC_STR, NCI, ALPHAL, ALPHAS, Collections.emptyList());
CellIdentityNr anotherCellIdentityNr = new CellIdentityNr(PCI, TAC, NRARFCN, BANDS, MCC_STR, MNC_STR, NCI + 1, ALPHAL, ALPHAS, Collections.emptyList());
// THEN this two objects are different
assertThat(cellIdentityNr).isNotEqualTo(anotherCellIdentityNr);
}
use of android.telephony.CellIdentityNr in project android_frameworks_opt_telephony by LineageOS.
the class CellIdentityNrTest method testEquals_sameParameters.
@Test
public void testEquals_sameParameters() {
// GIVEN an instance of CellIdentityNr, and create another object with the same parameters
CellIdentityNr cellIdentityNr = new CellIdentityNr(PCI, TAC, NRARFCN, BANDS, MCC_STR, MNC_STR, NCI, ALPHAL, ALPHAS, Collections.emptyList());
CellIdentityNr anotherCellIdentityNr = new CellIdentityNr(PCI, TAC, NRARFCN, BANDS, MCC_STR, MNC_STR, NCI, ALPHAL, ALPHAS, Collections.emptyList());
// THEN this two objects are equivalent
assertThat(cellIdentityNr).isEqualTo(anotherCellIdentityNr);
}
use of android.telephony.CellIdentityNr in project android_frameworks_opt_telephony by LineageOS.
the class CellIdentityNrTest method testParcel.
@Test
public void testParcel() {
// GIVEN an instance of CellIdentityNr
CellIdentityNr cellIdentityNr = new CellIdentityNr(PCI, TAC, NRARFCN, BANDS, MCC_STR, MNC_STR, NCI, ALPHAL, ALPHAS, Collections.emptyList());
// WHEN write the object to parcel and create another object with that parcel
Parcel parcel = Parcel.obtain();
cellIdentityNr.writeToParcel(parcel, 0);
parcel.setDataPosition(0);
CellIdentityNr anotherCellIdentityNr = CellIdentityNr.CREATOR.createFromParcel(parcel);
// THEN the new object is equal to the old one
assertThat(anotherCellIdentityNr).isEqualTo(cellIdentityNr);
assertThat(anotherCellIdentityNr.getType()).isEqualTo(CellInfo.TYPE_NR);
assertThat(anotherCellIdentityNr.getNrarfcn()).isEqualTo(NRARFCN);
assertThat(anotherCellIdentityNr.getPci()).isEqualTo(PCI);
assertThat(anotherCellIdentityNr.getTac()).isEqualTo(TAC);
assertTrue(Arrays.equals(anotherCellIdentityNr.getBands(), BANDS));
assertThat(anotherCellIdentityNr.getOperatorAlphaLong()).isEqualTo(ALPHAL);
assertThat(anotherCellIdentityNr.getOperatorAlphaShort()).isEqualTo(ALPHAS);
assertThat(anotherCellIdentityNr.getMccString()).isEqualTo(MCC_STR);
assertThat(anotherCellIdentityNr.getMncString()).isEqualTo(MNC_STR);
assertThat(anotherCellIdentityNr.getNci()).isEqualTo(NCI);
}
use of android.telephony.CellIdentityNr in project android_frameworks_opt_telephony by LineageOS.
the class CellIdentityTest method testIsSameCell.
@SmallTest
public void testIsSameCell() {
int curCi = 268435455;
CellIdentity ciA = new CellIdentityLte(curCi, PCI, TAC, EARFCN, BANDS, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
CellIdentity ciB = new CellIdentityLte(curCi, PCI, TAC, EARFCN, BANDS, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
CellIdentity ciC = new CellIdentityLte(curCi, PCI, TAC, EARFCN, BANDS, BANDWIDTH, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
CellIdentity ciD = new CellIdentityLte(-1, PCI, TAC, EARFCN, BANDS, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
assertTrue(ciA.isSameCell(ciB));
assertFalse(ciA.isSameCell(null));
assertFalse(ciA.isSameCell(ciC));
assertFalse(ciA.isSameCell(ciD));
CellIdentityNr cellIdentityNr = new CellIdentityNr(PCI, TAC, EARFCN, BANDS, MCC_STR, MNC_STR, curCi, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
assertFalse(ciA.isSameCell(cellIdentityNr));
}
use of android.telephony.CellIdentityNr in project android_frameworks_opt_telephony by LineageOS.
the class CellIdentityTest method testGetMccMncString.
@SmallTest
public void testGetMccMncString() {
List<CellIdentity> identities = new ArrayList<>(5);
CellIdentityGsm gsm = new CellIdentityGsm(MAX_LAC, MAX_CID, MAX_ARFCN, MAX_BSIC, MCC_STR, MNC_STR, null, null, Collections.emptyList());
identities.add(gsm);
CellIdentityCdma cdma = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT);
identities.add(cdma);
CellIdentity lte = new CellIdentityLte(CI, PCI, TAC, EARFCN, BANDS, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
identities.add(lte);
CellIdentityWcdma wcdma = new CellIdentityWcdma(MAX_LAC, MAX_CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
identities.add(wcdma);
CellIdentityTdscdma tdscdma = new CellIdentityTdscdma(MCC_STR, MNC_STR, MAX_LAC, MAX_CID, CPID, UARFCN, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
identities.add(tdscdma);
CellIdentityNr nr = new CellIdentityNr(PCI, TAC, EARFCN, BANDS, MCC_STR, MNC_STR, CI, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
identities.add(nr);
for (CellIdentity identity : identities) {
final String mccStr = identity.getMccString();
final String mncStr = identity.getMncString();
if (identity instanceof CellIdentityCdma) {
assertNull(mccStr);
assertNull(mncStr);
} else {
assertEquals(MCC_STR, mccStr);
assertEquals(MNC_STR, mncStr);
}
}
}
Aggregations