/*
 * Copyright (C) 2015 8tory, Inc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package rx.bolts;

import org.junit.Test;
import bolts.Task;

//import static org.mockito.Matchers.any;
//import static org.mockito.Mockito.mock;
//import static org.mockito.Mockito.times;
//import static org.mockito.Mockito.verify;
//import static org.mockito.Mockito.when;
//import static org.mockito.Mockito.doReturn;
//import static mocker.Mocker.mocker;
//import mocker.Mocker;
import static rx.assertions.RxAssertions.assertThat;

public class TaskObservableTests {

    @Test
    public void just() {
        assertThat(TaskObservable.just(Task.<String>forResult(null)))
            .withoutErrors()
            .emitsNothing()
            .completes();

        assertThat(TaskObservable.just(Task.forResult("hello")))
            .withoutErrors()
            .expectedValues("hello")
            .completes();
    }

    @Test
    public void justNullable() {
        assertThat(TaskObservable.justNullable(Task.<String>forResult(null)))
            .withoutErrors()
            .expectedValues((String) null)
            .completes();
    }

    @Test
    public void defer() {
        assertThat(TaskObservable.defer(() -> Task.<String>forResult(null)))
            .withoutErrors()
            .emitsNothing()
            .completes();

        assertThat(TaskObservable.defer(() -> Task.forResult("hello")))
            .withoutErrors()
            .expectedValues("hello")
            .completes();
    }

    @Test
    public void deferNullable() {
        assertThat(TaskObservable.deferNullable(() -> Task.<String>forResult(null)))
            .withoutErrors()
            .expectedValues((String) null)
            .completes();
    }

    @Test
    public void deferNonNull() {
        assertThat(TaskObservable.deferNonNull(() -> Task.<String>forResult(null)))
            .failsWithThrowable(NullPointerException.class);
    }


}

@@ -1028,16 +1028,78 @@
 ertThat;
+%0Aimport org.assertj.core.api.Assertions;%0Aimport rx.Observable;
 %0A%0Apublic
@@ -1473,32 +1473,239 @@
 letes();%0A    %7D%0A%0A
+    @Test%0A    public void justDefer() %7B%0A        assertThat(TaskObservable.defer(() -%3E Task.%3CString%3EforResult(null)))%0A            .withoutErrors()%0A            .emitsNothing()%0A            .completes();%0A    %7D%0A%0A
     @Test%0A    pu
@@ -2711,11 +2711,151 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void forTask() %7B%0A        Assertions.assertThat(TaskObservable.forTask(Observable.empty()).getResult()).isNull();%0A    %7D%0A
 %0A%7D%0A

Add tests