### Question:
PillDetailsFragment extends DeviceDetailsFragment<SleepPillDevice> { private boolean shouldShowUpdateFirmwareAction() { return !device.hasLowBattery() && device.shouldUpdate() && deviceIssuesPresenter.shouldShowUpdateFirmwareAction(device.deviceId); }  static PillDetailsFragment newInstance(@NonNull SleepPillDevice device); @Override void onCreate(Bundle savedInstanceState); @Override void onViewCreated(View view, Bundle savedInstanceState); @Override void onActivityResult(int requestCode, int resultCode, Intent data); void updateFirmware(); void replaceDevice(); void replaceBattery(); void showAdvancedOptions();  }### Answer:
@Test public void shouldShowUpdateFirmwareAction() throws Exception { final SleepPillDevice testPill = createMockPill(); doReturn(false).when(testPill).hasLowBattery(); doReturn(true).when(testPill).shouldUpdate(); final PillDetailsFragment fragment = setUpWith(testPill); verify(fragment).addDeviceAction(eq(R.drawable.icon_refresh_24), eq(R.string.action_update_firmware), any()); }