package com.raulh82vlc.MoviesFinder.domain.mapper;

import com.raulh82vlc.MoviesFinder.di.scopes.ActivityScope;
import com.raulh82vlc.MoviesFinder.domain.models.Movie;
import com.raulh82vlc.MoviesFinder.domain.models.MovieUI;

import javax.inject.Inject;

/**
 * Mapper conversion from Movie model of the API to Movie model of the UI
 *
 * @author Raul Hernandez Lopez
 */
@ActivityScope
public class MovieDetailsModelDataMapper {

    @Inject
    public MovieDetailsModelDataMapper() {

    }

    /**
     * Transforms a {@link Movie} into an {@link MovieUI}.
     */
    public MovieUI transform(Movie movie) {
        MovieUI movieUI = new MovieUI();
        movieUI.setSynopsis(movie.getSynopsis());
        movieUI.setVotes(movie.getNumVotes());
        movieUI.setRating(movie.getRating());
        movieUI.setActors(movie.getActors());
        movieUI.setAwards(movie.getAwards());
        movieUI.setDirector(movie.getDirector());
        movieUI.setDuration(movie.getDuration());
        movieUI.setWriter(movie.getWriter());
        movieUI.setRatedForQualifiedPublic(movie.getRatedForPublic());
        return movieUI;
    }
}

@@ -607,16 +607,136 @@
 ovie) %7B%0A
+        if (movie == null) %7B%0A            throw new IllegalArgumentException(%22Cannot transform a null value%22);%0A        %7D%0A
         

Raise an exception when null object on MovieDetailsModelDataMapper