### Question:
CorePeripheralManager implements PeripheralManager { @Override public <T> Single<T> queueOperation(PeripheralOperation<T> peripheralOperation) { return peripheralOperation .result() .doOnSubscribe(disposable -> processOperation(peripheralOperation)) .doFinally(() -> endOperation(peripheralOperation)); }  @Override void setPeripheral(Peripheral peripheral); @Override Single<T> queueOperation(PeripheralOperation<T> peripheralOperation); @Override Observable<Boolean> connected(); @Override Observable<byte[]> notification(UUID characteristic);  }### Answer:
@Test public void queueOperations() { when(peripheralOperation1.result()).thenReturn(operationResultSubject1.hide()); when(peripheralOperation2.result()).thenReturn(operationResultSubject2.hide()); when(peripheralOperation3.result()).thenReturn(operationResultSubject3.hide()); when(peripheralOperation4.result()).thenReturn(operationResultSubject4.hide()); Single<Irrelevant> op1 = corePeripheralManager.queueOperation(peripheralOperation1); verify(peripheralOperation1, times(0)).execute(any()); Single<Irrelevant> op2 = corePeripheralManager.queueOperation(peripheralOperation2); verify(peripheralOperation2, times(0)).execute(any()); Single<Irrelevant> op3 = corePeripheralManager.queueOperation(peripheralOperation3); verify(peripheralOperation3, times(0)).execute(any()); op1.test(); op2.test(); TestObserver op3Observer = op3.test(); verify(peripheralOperation1).execute(any()); verify(peripheralOperation2, times(0)).execute(any()); op3Observer.dispose(); operationResultSubject1.onSuccess(Irrelevant.INSTANCE); verify(peripheralOperation2).execute(any()); Single<Irrelevant> op4 = corePeripheralManager.queueOperation(peripheralOperation4); op4.test(); verify(peripheralOperation4, times(0)).execute(any()); operationResultSubject2.onError(new Exception()); verify(peripheralOperation4).execute(any()); verify(peripheralOperation3, times(0)).execute(any()); }