@Test
public void testStartAndBindService() throws InterruptedException {

    CountDownLatch latch1 = new CountDownLatch(1);
    CountDownLatch latch2 = new CountDownLatch(1);
    ServiceConnection connection = new ServiceConnection() {
        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            connectionStatus = "connected";
            latch1.countDown();
        }
        @Override
        public void onServiceDisconnected(ComponentName name) {
            connectionStatus = "disconnected";
            latch2.countDown();
        }
    };
    assertEquals(connectionStatus, "");
    TrackingService.startAndBindService(context, MapActivity.class, connection, new TrackingServiceHighAccuracyOptions());
    latch1.await();
    assertEquals(connectionStatus, "connected");
    TrackingService.stopAndUnbindService(context, connection);
    latch2.await();
    assertEquals(connectionStatus, "disconnected");
}