2

I have an external sensor connected with Android phone through USB port. The so-far implementation of application is an android service which after initialization of sensor is polling it for values.

Sensor comes with its API own and initialization goes like:

module = YModule.FirstModule();
while (module != null) {
    if (module.get_productName().equals("xxxxxx")) {
    // save the serial number
    serial = module.get_serialNumber();
    break;
}
module = module.nextModule();

And the polling goes like:

Runnable runnable= new Runnable() {
    @Override
    public void run() {
        if (module.isOnline()) {
            //do stuff here
        }
    }
};

I would like to create tests for the above code and probably mock (?) the hardware and i would like some tips and directions on how to start and what to read. Is this possible at all?

WilQu
  • 7,131
  • 6
  • 30
  • 38
Panos Karampis
  • 557
  • 6
  • 18

0 Answers0