### Question:
CheckConnectionUseCase { public Single<Boolean> execute() { return wlanRepository.isConnectedToWiFi(); } @Inject  CheckConnectionUseCase(WlanRepository wlanRepository); Single<Boolean> execute(); Completable executeCompletable();  }### Answer:
@Test public void execute_connectionReturnsTrue() { when(wlanRepository.isConnectedToWiFi()).thenReturn(Single.just(true)); useCase.execute() .test() .assertValue(true); }
@Test public void execute_noConnectionReturnsFalse() { when(wlanRepository.isConnectedToWiFi()).thenReturn(Single.just(false)); useCase.execute() .test() .assertValue(false); }
@Test public void executeCompletable_connectionReturnsComplete() { when(wlanRepository.isConnectedToWiFi()).thenReturn(Single.just(true)); useCase.execute() .test() .assertComplete(); }