Loading tests/telephonytests/src/com/android/internal/telephony/CellIdentityNrTest.java +10 −6 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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); Loading @@ -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); Loading @@ -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(); Loading @@ -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); } } Loading
tests/telephonytests/src/com/android/internal/telephony/CellIdentityNrTest.java +10 −6 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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); Loading @@ -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); Loading @@ -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(); Loading @@ -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); } }