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

Commit 73cdb89b authored by Nathan Harold's avatar Nathan Harold Committed by android-build-merger
Browse files

Merge "Add NCI to CellIdentityNrTest" am: b68d92a9

am: 5cc8801e

Change-Id: I6f8d88a1819101786de45fc22934eea0bd12c7cc
parents 6dba7263 5cc8801e
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);
    }
}