    @Test
    public void testMaybe() {

        final String hello = "Hello, world!";
        when(mockHelloTask.getResult())
                .thenReturn(hello);
        when(mockHelloTask.isSuccessful())
                .thenReturn(true);
        when(mockHelloTask.addOnCompleteListener(onComplete.capture()))
                .thenReturn(mockHelloTask);

        TestObserver<String> obs = TestObserver.create();
        RxTask.maybe(mockHelloTask).subscribe(obs);
        verify(mockHelloTask).addOnCompleteListener(onComplete.capture());
        onComplete.getValue().onComplete(mockHelloTask);

        obs.assertValue(hello)
                .assertNoErrors()
                .assertComplete();

        verify(mockHelloTask).addOnCompleteListener(any(OnCompleteListener.class));
        verify(mockHelloTask).getResult();
    }