// Path: app/src/main/java/apidez/com/databinding/model/api/IPlacesApi.java
// public interface IPlacesApi {
//     @GET("nearbysearch/json?location=10.7864422,106.677516&radius=500&types=food&key=AIzaSyBk3A8Q3pqVWYYmZhODbE-D2lf2ZHEoKuo")
//     Observable<GoogleSearchResult> placesResult();
// }
// 
// Path: app/src/main/java/apidez/com/databinding/model/entity/GoogleSearchResult.java
// public class GoogleSearchResult {
// 
//     @SerializedName("status")
//     public String status;
// 
//     @SerializedName("results")
//     public List<Place> results;
// }
// 
// Path: app/src/main/java/apidez/com/databinding/model/entity/Place.java
// public class Place extends BaseObservable {
// 
//     @SerializedName("icon")
//     private String icon;
// 
//     @SerializedName("place_id")
//     private String id;
// 
//     @SerializedName("name")
//     private String name;
// 
//     @SerializedName("types")
//     private List<String> types;
// 
//     private Place(String icon, String id, String name, List<String> types) {
//         this.icon = icon;
//         this.id = id;
//         this.name = name;
//         this.types = types;
//     }
// 
//     @Bindable
//     public String getIcon() {
//         return icon;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     @Bindable
//     public String getName() {
//         return name;
//     }
// 
//     public List<String> getTypes() {
//         return types;
//     }
// 
//     public static class Builder {
//         private String id = UUID.randomUUID().toString();
//         private String icon;
//         private String name;
//         private List<String> types;
// 
//         public Builder name(String name) {
//             this.name = name;
//             return this;
//         }
// 
//         public Builder icon(String icon) {
//             this.icon = icon;
//             return this;
//         }
// 
//         public Builder types(List<String> types) {
//             this.types = types;
//             return this;
//         }
// 
//         public Place build() {
//             return new Place(icon, id, name, types);
//         }
//     }
// }
// 
// Path: app/src/main/java/apidez/com/databinding/utils/RxUtils.java
// public class RxUtils {
// 
//     public static class SchedulerHolder {
//         public Scheduler mainScheduler;
//         public Scheduler ioScheduler;
// 
//         public SchedulerHolder(Scheduler mainScheduler, Scheduler ioScheduler) {
//             this.mainScheduler = mainScheduler;
//             this.ioScheduler = ioScheduler;
//         }
//     }
// }
// 
// Path: app/src/main/java/apidez/com/databinding/utils/TestDataUtils.java
// public class TestDataUtils {
// 
//     /**
//      * Google search nearby test data
//      */
//     public static GoogleSearchResult nearByData() {
//         List<Place> places = new ArrayList<>();
//         places.add(new Place.Builder().icon("url").name("A").types(Arrays.asList("food", "cafe")).build());
//         places.add(new Place.Builder().name("B").types(Arrays.asList("food", "movie_theater")).build());
//         places.add(new Place.Builder().name("C").types(Arrays.asList("store")).build());
//         places.add(new Place.Builder().name("D").types(Arrays.asList("store")).build());
//         places.add(new Place.Builder().name("E").types(Arrays.asList("cafe")).build());
//         places.add(new Place.Builder().name("F").types(Arrays.asList("food", "store", "cafe", "movie_theater")).build());
//         places.add(new Place.Builder().name("G").types(Arrays.asList("restaurant", "store")).build());
//         places.add(new Place.Builder().name("H").types(Arrays.asList("restaurant", "cafe")).build());
//         places.add(new Place.Builder().name("I").types(Arrays.asList("restaurant")).build());
//         places.add(new Place.Builder().name("K").types(Arrays.asList("movie_theater", "cafe", "food")).build());
//         GoogleSearchResult googleSearchResult = new GoogleSearchResult();
//         googleSearchResult.status = "OK";
//         googleSearchResult.results = places;
//         return googleSearchResult;
//     }
// }


import android.test.suitebuilder.annotation.SmallTest;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mockito;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import apidez.com.databinding.model.api.IPlacesApi;
import apidez.com.databinding.model.entity.GoogleSearchResult;
import apidez.com.databinding.model.entity.Place;
import apidez.com.databinding.utils.RxUtils;
import apidez.com.databinding.utils.TestDataUtils;
import rx.Observable;
import rx.observers.TestSubscriber;
import rx.schedulers.Schedulers;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
package apidez.com.databinding.viewmodel;






/**
 * Created by nongdenchet on 10/30/15.
 */
@SmallTest
@RunWith(JUnit4.class)
public class PlacesViewModelTest {
    private PlacesViewModel placesViewModel;
    private IPlacesApi placesApi;
    private TestSubscriber<Boolean> testSubscriber;

    @Before
    public void setUpViewModel() {
        placesApi = Mockito.mock(IPlacesApi.class);
        placesViewModel = new PlacesViewModel(placesApi,
                new RxUtils.SchedulerHolder(Schedulers.immediate(), Schedulers.immediate()));
        testSubscriber = TestSubscriber.create();
// Path: app/src/main/java/apidez/com/databinding/model/api/IPlacesApi.java
// public interface IPlacesApi {
//     @GET("nearbysearch/json?location=10.7864422,106.677516&radius=500&types=food&key=AIzaSyBk3A8Q3pqVWYYmZhODbE-D2lf2ZHEoKuo")
//     Observable<GoogleSearchResult> placesResult();
// }
// 
// Path: app/src/main/java/apidez/com/databinding/model/entity/GoogleSearchResult.java
// public class GoogleSearchResult {
// 
//     @SerializedName("status")
//     public String status;
// 
//     @SerializedName("results")
//     public List<Place> results;
// }
// 
// Path: app/src/main/java/apidez/com/databinding/model/entity/Place.java
// public class Place extends BaseObservable {
// 
//     @SerializedName("icon")
//     private String icon;
// 
//     @SerializedName("place_id")
//     private String id;
// 
//     @SerializedName("name")
//     private String name;
// 
//     @SerializedName("types")
//     private List<String> types;
// 
//     private Place(String icon, String id, String name, List<String> types) {
//         this.icon = icon;
//         this.id = id;
//         this.name = name;
//         this.types = types;
//     }
// 
//     @Bindable
//     public String getIcon() {
//         return icon;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     @Bindable
//     public String getName() {
//         return name;
//     }
// 
//     public List<String> getTypes() {
//         return types;
//     }
// 
//     public static class Builder {
//         private String id = UUID.randomUUID().toString();
//         private String icon;
//         private String name;
//         private List<String> types;
// 
//         public Builder name(String name) {
//             this.name = name;
//             return this;
//         }
// 
//         public Builder icon(String icon) {
//             this.icon = icon;
//             return this;
//         }
// 
//         public Builder types(List<String> types) {
//             this.types = types;
//             return this;
//         }
// 
//         public Place build() {
//             return new Place(icon, id, name, types);
//         }
//     }
// }
// 
// Path: app/src/main/java/apidez/com/databinding/utils/RxUtils.java
// public class RxUtils {
// 
//     public static class SchedulerHolder {
//         public Scheduler mainScheduler;
//         public Scheduler ioScheduler;
// 
//         public SchedulerHolder(Scheduler mainScheduler, Scheduler ioScheduler) {
//             this.mainScheduler = mainScheduler;
//             this.ioScheduler = ioScheduler;
//         }
//     }
// }
// 
// Path: app/src/main/java/apidez/com/databinding/utils/TestDataUtils.java
// public class TestDataUtils {
// 
//     /**
//      * Google search nearby test data
//      */
//     public static GoogleSearchResult nearByData() {
//         List<Place> places = new ArrayList<>();
//         places.add(new Place.Builder().icon("url").name("A").types(Arrays.asList("food", "cafe")).build());
//         places.add(new Place.Builder().name("B").types(Arrays.asList("food", "movie_theater")).build());
//         places.add(new Place.Builder().name("C").types(Arrays.asList("store")).build());
//         places.add(new Place.Builder().name("D").types(Arrays.asList("store")).build());
//         places.add(new Place.Builder().name("E").types(Arrays.asList("cafe")).build());
//         places.add(new Place.Builder().name("F").types(Arrays.asList("food", "store", "cafe", "movie_theater")).build());
//         places.add(new Place.Builder().name("G").types(Arrays.asList("restaurant", "store")).build());
//         places.add(new Place.Builder().name("H").types(Arrays.asList("restaurant", "cafe")).build());
//         places.add(new Place.Builder().name("I").types(Arrays.asList("restaurant")).build());
//         places.add(new Place.Builder().name("K").types(Arrays.asList("movie_theater", "cafe", "food")).build());
//         GoogleSearchResult googleSearchResult = new GoogleSearchResult();
//         googleSearchResult.status = "OK";
//         googleSearchResult.results = places;
//         return googleSearchResult;
//     }
// }


// Path: app/src/test/java/apidez/com/databinding/viewmodel/PlacesViewModelTest.java
import android.test.suitebuilder.annotation.SmallTest;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mockito;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import apidez.com.databinding.model.api.IPlacesApi;
import apidez.com.databinding.model.entity.GoogleSearchResult;
import apidez.com.databinding.model.entity.Place;
import apidez.com.databinding.utils.RxUtils;
import apidez.com.databinding.utils.TestDataUtils;
import rx.Observable;
import rx.observers.TestSubscriber;
import rx.schedulers.Schedulers;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;

package apidez.com.databinding.viewmodel;






/**
 * Created by nongdenchet on 10/30/15.
 */
@SmallTest
@RunWith(JUnit4.class)
public class PlacesViewModelTest {
    private PlacesViewModel placesViewModel;
    private IPlacesApi placesApi;
    private TestSubscriber<Boolean> testSubscriber;

    @Before
    public void setUpViewModel() {
        placesApi = Mockito.mock(IPlacesApi.class);
        placesViewModel = new PlacesViewModel(placesApi,
                new RxUtils.SchedulerHolder(Schedulers.immediate(), Schedulers.immediate()));
        testSubscriber = TestSubscriber.create();
        when(placesApi.placesResult()).thenReturn(testDataObservable());