Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70c4f22b authored by Sarah Chin's avatar Sarah Chin
Browse files

Update CellIdentityNr constructor in tests

Test: atest FrameworksTelephonyTests
Bug: 131061889
Change-Id: Ie4d1def9b4e446dce1dc286f6854b662dcc86268
Merged-In: Ie4d1def9b4e446dce1dc286f6854b662dcc86268
parent a3634b76
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.internal.telephony;
import static com.google.common.truth.Truth.assertThat;

import android.os.Parcel;
import android.telephony.AccessNetworkConstants;
import android.telephony.CellIdentityNr;
import android.telephony.CellInfo;
import android.test.AndroidTestCase;
@@ -38,12 +39,13 @@ public class CellIdentityNrTest extends AndroidTestCase {
    private static final int PCI = 123;
    private static final int TAC = 32767;
    private static final int NCI = 8675309;
    private static final int BAND = AccessNetworkConstants.NgranBands.BAND_1;

    @Test
    public void testGetMethod() {
        // GIVEN an instance of CellIdentityNr
        CellIdentityNr cellIdentityNr =
                new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, NCI, ALPHAL, ALPHAS,
                new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI, ALPHAL, ALPHAS,
                        Collections.emptyList());

        // THEN the get method should return correct value
@@ -63,10 +65,10 @@ public class CellIdentityNrTest extends AndroidTestCase {
    public void testEquals_sameParameters() {
        // GIVEN an instance of CellIdentityNr, and create another object with the same parameters
        CellIdentityNr cellIdentityNr =
                new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, NCI, ALPHAL, ALPHAS,
                new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI, ALPHAL, ALPHAS,
                        Collections.emptyList());
        CellIdentityNr anotherCellIdentityNr =
                new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, NCI, ALPHAL, ALPHAS,
                new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI, ALPHAL, ALPHAS,
                        Collections.emptyList());

        // THEN this two objects are equivalent
@@ -77,10 +79,10 @@ public class CellIdentityNrTest extends AndroidTestCase {
    public void testEquals_differentParameters() {
        // GIVEN an instance of CellIdentityNr, and create another object with different parameters
        CellIdentityNr cellIdentityNr =
                new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, NCI, ALPHAL, ALPHAS,
                new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI, ALPHAL, ALPHAS,
                        Collections.emptyList());
        CellIdentityNr anotherCellIdentityNr =
                new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, NCI + 1, ALPHAL, ALPHAS,
                new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI + 1, ALPHAL, ALPHAS,
                        Collections.emptyList());

        // THEN this two objects are different
@@ -91,7 +93,7 @@ public class CellIdentityNrTest extends AndroidTestCase {
    public void testParcel() {
        // GIVEN an instance of CellIdentityNr
        CellIdentityNr cellIdentityNr =
                new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, NCI, ALPHAL, ALPHAS,
                new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI, ALPHAL, ALPHAS,
                        Collections.emptyList());

        // WHEN write the object to parcel and create another object with that parcel
@@ -106,6 +108,7 @@ public class CellIdentityNrTest extends AndroidTestCase {
        assertThat(anotherCellIdentityNr.getNrarfcn()).isEqualTo(NRARFCN);
        assertThat(anotherCellIdentityNr.getPci()).isEqualTo(PCI);
        assertThat(anotherCellIdentityNr.getTac()).isEqualTo(TAC);
        assertThat(anotherCellIdentityNr.getBand()).isEqualTo(BAND);
        assertThat(anotherCellIdentityNr.getOperatorAlphaLong()).isEqualTo(ALPHAL);
        assertThat(anotherCellIdentityNr.getOperatorAlphaShort()).isEqualTo(ALPHAS);
        assertThat(anotherCellIdentityNr.getMccString()).isEqualTo(MCC);
+3 −2
Original line number Diff line number Diff line
@@ -1619,8 +1619,9 @@ public class RILTest extends TelephonyTest {
        CellSignalStrengthNr signalStrengthNr =
                (CellSignalStrengthNr) cellInfoNr.getCellSignalStrength();

        CellIdentityNr expectedCellIdentity = new CellIdentityNr(PCI, TAC, NRARFCN, MCC_STR,
                MNC_STR, CI, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
        CellIdentityNr expectedCellIdentity = new CellIdentityNr(PCI, TAC, NRARFCN,
                CellInfo.UNAVAILABLE, MCC_STR, MNC_STR, CI, ALPHA_LONG, ALPHA_SHORT,
                Collections.emptyList());
        CellSignalStrengthNr expectedSignalStrength = new CellSignalStrengthNr(-RSRP, -RSRQ,
                SIGNAL_NOISE_RATIO, -RSRP, -RSRQ, SIGNAL_NOISE_RATIO);