OADProfile extends BaseProfile { public OADApproval programWithFirmware(final FirmwareBundle bundle, OADListener listener) { if (!mGattClient.isConnected()) { listener.error(BeanError.NOT_CONNECTED); } Log.i(TAG, "Starting firmware update procedure"); this.oadListener = listener; this.firmwareBundle = bundle; watchdog.start(OAD_TIMEOUT_SECONDS, watchdogListener); checkFirmwareVersion(); return this.oadApproval; } OADProfile(GattClient client, Watchdog watchdog); String getName(); boolean isReady(); void clearReady(); boolean uploadInProgress(); OADState getState(); @Override void onProfileReady(); void continueOAD(); @Override void onBeanConnected(); @Override void onBeanDisconnected(); @Override void onBeanConnectionFailed(); @Override void onCharacteristicChanged(GattClient client, BluetoothGattCharacteristic characteristic); OADApproval programWithFirmware(final FirmwareBundle bundle, OADListener listener);  }
@Test public void testNoUpdateNeeded() throws ImageParsingException { OADProfile.OADListener oadListener = mock(OADProfile.OADListener.class); OADProfile.OADApproval oadApproval = oadProfile.programWithFirmware(buildBundle(), oadListener); assertState(OADState.CHECKING_FW_VERSION); fwVersionCallback.onComplete("12345"); assertState(OADState.INACTIVE); verify(oadListener).updateRequired(false); verify(oadListener, never()).error(any(BeanError.class)); }