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

Commit 6b11aeb8 authored by Nathan Harold's avatar Nathan Harold
Browse files

Add NCI to CellIdentityNrTest

Add NCI to the tests for CellIdentityNr.

Bug: 124126359
Test: atest FrameworksTelephonyTests
Change-Id: Ife8c7576db039995a8607386a23ce1060d7c5c34
parent b4d55f76
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -35,12 +35,13 @@ public class CellIdentityNrTest extends AndroidTestCase {
    private static final int NRARFCN = 13456;
    private static final int PCI = 123;
    private static final int TAC = 32767;
    private static final int NCI = 8675309;

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

        // THEN the get method should return correct value
        assertThat(cellIdentityNr.getType()).isEqualTo(CellInfo.TYPE_NR);
@@ -51,15 +52,17 @@ public class CellIdentityNrTest extends AndroidTestCase {
        assertThat(cellIdentityNr.getOperatorAlphaShort()).isEqualTo(ALPHAS);
        assertThat(cellIdentityNr.getMccString()).isEqualTo(MCC);
        assertThat(cellIdentityNr.getMncString()).isEqualTo(MNC);
        assertThat(cellIdentityNr.getMncString()).isEqualTo(MNC);
        assertThat(cellIdentityNr.getNci()).isEqualTo(NCI);
    }

    @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, MCC, MNC, ALPHAL, ALPHAS);
                new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, NCI, ALPHAL, ALPHAS);
        CellIdentityNr anotherCellIdentityNr =
                new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, ALPHAL, ALPHAS);
                new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, NCI, ALPHAL, ALPHAS);

        // THEN this two objects are equivalent
        assertThat(cellIdentityNr).isEqualTo(anotherCellIdentityNr);
@@ -69,9 +72,9 @@ 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, ALPHAL, ALPHAS);
                new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, NCI, ALPHAL, ALPHAS);
        CellIdentityNr anotherCellIdentityNr =
                new CellIdentityNr(PCI, TAC, NRARFCN, ANOTHER_MCC, ANOTHER_MNC, ALPHAL, ALPHAS);
                new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, NCI + 1, ALPHAL, ALPHAS);

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

        // WHEN write the object to parcel and create another object with that parcel
        Parcel parcel = Parcel.obtain();
@@ -99,5 +102,6 @@ public class CellIdentityNrTest extends AndroidTestCase {
        assertThat(anotherCellIdentityNr.getOperatorAlphaShort()).isEqualTo(ALPHAS);
        assertThat(anotherCellIdentityNr.getMccString()).isEqualTo(MCC);
        assertThat(anotherCellIdentityNr.getMncString()).isEqualTo(MNC);
        assertThat(anotherCellIdentityNr.getNci()).isEqualTo(NCI);
    }
}