// Path: base/src/main/java/com/tobi/movies/popularstream/ApiPopularMoviesResponse.java
// public class ApiPopularMoviesResponse {
// 
//     @SerializedName("results")
//     List<ApiMoviePoster> results;
// }
// 
// Path: app/src/androidTest/java/com/tobi/movies/popularstream/PublicApiPopularMoviesResponse.java
// public class PublicApiPopularMoviesResponse extends ApiPopularMoviesResponse {
// 
//     public PublicApiPopularMoviesResponse(List<ApiMoviePoster> results) {
//         this.results = results;
//     }
// 
// }
// 
// Path: base/src/main/java/com/tobi/movies/posterdetails/ApiMovieDetails.java
// public class ApiMovieDetails {
// 
//     @SerializedName("id")
//     public long movieId;
// 
//     @SerializedName("poster_path")
//     public String posterPath;
// 
//     @SerializedName("original_title")
//     public String originalTitle;
// 
//     @SerializedName("overview")
//     public String overview;
// 
//     @SerializedName("release_date")
//     public String releaseDate;
// }


import android.support.test.espresso.core.deps.guava.collect.Lists;
import com.tobi.movies.popularstream.ApiMoviePoster;
import com.tobi.movies.popularstream.ApiPopularMoviesResponse;
import com.tobi.movies.popularstream.PublicApiPopularMoviesResponse;
import com.tobi.movies.posterdetails.ApiMovieDetails;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import retrofit2.http.Path;
import rx.Observable;
package com.tobi.movies.backend;





public class ConfigurableBackend implements Backend {

    private final Map<Long, ApiMovieDetails> movieDetails = new HashMap<>();
    private final List<ApiMoviePoster> popularStream = Lists.newArrayList();

    public void addMovieDetails(ApiMovieDetails apiMovieDetails) {
        movieDetails.put(apiMovieDetails.movieId, apiMovieDetails);
    }

    public void addToPopularStream(ApiMoviePoster movieDetails) {
        popularStream.add(movieDetails);
    }

    @Override
    public Observable<ApiPopularMoviesResponse> popularStream() {
        return Observable.fromCallable(new Callable<ApiPopularMoviesResponse>() {
            @Override
            public ApiPopularMoviesResponse call() throws Exception {
                return new PublicApiPopularMoviesResponse(popularStream);
            }
        });
    }

    @Override
    public Observable<ApiMovieDetails> movieDetails(@Path("id") final long movieId) {
        return Observable.fromCallable(new Callable<ApiMovieDetails>() {
            @Override
            public ApiMovieDetails call() throws Exception {
// Path: base/src/main/java/com/tobi/movies/popularstream/ApiPopularMoviesResponse.java
// public class ApiPopularMoviesResponse {
// 
//     @SerializedName("results")
//     List<ApiMoviePoster> results;
// }
// 
// Path: app/src/androidTest/java/com/tobi/movies/popularstream/PublicApiPopularMoviesResponse.java
// public class PublicApiPopularMoviesResponse extends ApiPopularMoviesResponse {
// 
//     public PublicApiPopularMoviesResponse(List<ApiMoviePoster> results) {
//         this.results = results;
//     }
// 
// }
// 
// Path: base/src/main/java/com/tobi/movies/posterdetails/ApiMovieDetails.java
// public class ApiMovieDetails {
// 
//     @SerializedName("id")
//     public long movieId;
// 
//     @SerializedName("poster_path")
//     public String posterPath;
// 
//     @SerializedName("original_title")
//     public String originalTitle;
// 
//     @SerializedName("overview")
//     public String overview;
// 
//     @SerializedName("release_date")
//     public String releaseDate;
// }


// Path: app/src/androidTest/java/com/tobi/movies/backend/ConfigurableBackend.java
import android.support.test.espresso.core.deps.guava.collect.Lists;
import com.tobi.movies.popularstream.ApiMoviePoster;
import com.tobi.movies.popularstream.ApiPopularMoviesResponse;
import com.tobi.movies.popularstream.PublicApiPopularMoviesResponse;
import com.tobi.movies.posterdetails.ApiMovieDetails;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import retrofit2.http.Path;
import rx.Observable;

package com.tobi.movies.backend;





public class ConfigurableBackend implements Backend {

    private final Map<Long, ApiMovieDetails> movieDetails = new HashMap<>();
    private final List<ApiMoviePoster> popularStream = Lists.newArrayList();

    public void addMovieDetails(ApiMovieDetails apiMovieDetails) {
        movieDetails.put(apiMovieDetails.movieId, apiMovieDetails);
    }

    public void addToPopularStream(ApiMoviePoster movieDetails) {
        popularStream.add(movieDetails);
    }

    @Override
    public Observable<ApiPopularMoviesResponse> popularStream() {
        return Observable.fromCallable(new Callable<ApiPopularMoviesResponse>() {
            @Override
            public ApiPopularMoviesResponse call() throws Exception {
                return new PublicApiPopularMoviesResponse(popularStream);
            }
        });
    }

    @Override
    public Observable<ApiMovieDetails> movieDetails(@Path("id") final long movieId) {
        return Observable.fromCallable(new Callable<ApiMovieDetails>() {
            @Override
            public ApiMovieDetails call() throws Exception {
                return movieDetails.get(movieId);