Coverage Summary for Class: MovieMapperKt (concept.stc.data.mapper)
Class |
Class, %
|
Method, %
|
Branch, %
|
Line, %
|
MovieMapperKt |
100%
(1/1)
|
100%
(2/2)
|
50%
(1/2)
|
100%
(14/14)
|
package concept.stc.data.mapper
import concept.stc.data.local.entity.MovieEntity
import concept.stc.data.remote.model.SearchResponse
import concept.stc.domain.model.Movie
/**
* Maps response [SearchResponse.Movie] to database [MovieEntity].
*/
fun SearchResponse.Movie.toEntity() = MovieEntity(
id = null,
title = title,
year = year,
imdbId = imdbID,
type = type,
poster = poster
)
/**
* Maps database [MovieEntity] to domain [Movie].
*/
fun MovieEntity.toDomain() = Movie(
id = id ?: 0,
title = title,
year = year,
imdbId = imdbId,
type = type,
poster = poster
)