how to create an object of CellInfo for unit testing?

97 views Asked by At

I am writing unit test case, What I can't understand is how can I make a dummy object of CellinfoGsm or of any technology and test my code from it. I did read the documentation and the base class of CellInfo but I can't understand how to use the Creator, Can anyone give me an example of how to make my own object with my own values for testing purposes. Any help would be highly appreciated.

1

There are 1 answers

2
Profile_In_Making On

I am not much into Android and just trying to learn now. Can you make it work like this ->

CellInfoGsm gsm = mirror.android.telephony.CellInfoGsm.ctor.newInstance(); CellIdentityGsm identityGsm = mirror.android.telephony.CellInfoGsm.mCellIdentityGsm.get(gsm); CellSignalStrengthGsm strengthGsm = mirror.android.telephony.CellInfoGsm.mCellSignalStrengthGsm.get(gsm); mirror.android.telephony.CellIdentityGsm.mMcc.set(identityGsm, cell.mcc); mirror.android.telephony.CellIdentityGsm.mMnc.set(identityGsm, cell.mnc); mirror.android.telephony.CellIdentityGsm.mLac.set(identityGsm, cell.lac); mirror.android.telephony.CellIdentityGsm.mCid.set(identityGsm, cell.cid); mirror.android.telephony.CellSignalStrengthGsm.mSignalStrength.set(strengthGsm, 20); mirror.android.telephony.CellSignalStrengthGsm.mBitErrorRate.set(strengthGsm, 0);