-
Notifications
You must be signed in to change notification settings - Fork 9
/
EntityMapperTest.kt
72 lines (61 loc) · 2.34 KB
/
EntityMapperTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package com.jaimegc.covid19tracker.mapper
import com.jaimegc.covid19tracker.data.room.mapper.toEntity
import com.jaimegc.covid19tracker.domain.model.toDomain
import com.jaimegc.covid19tracker.ModelFactoryTest.country
import com.jaimegc.covid19tracker.ModelFactoryTest.countryEntity
import com.jaimegc.covid19tracker.ModelFactoryTest.countryOneStats
import com.jaimegc.covid19tracker.ModelFactoryTest.countryStatsEntity
import com.jaimegc.covid19tracker.ModelFactoryTest.region
import com.jaimegc.covid19tracker.ModelFactoryTest.regionEntity
import com.jaimegc.covid19tracker.ModelFactoryTest.regionStats
import com.jaimegc.covid19tracker.ModelFactoryTest.regionStatsEntity
import com.jaimegc.covid19tracker.ModelFactoryTest.stats
import com.jaimegc.covid19tracker.ModelFactoryTest.statsEmbedded
import com.jaimegc.covid19tracker.ModelFactoryTest.subRegion
import com.jaimegc.covid19tracker.ModelFactoryTest.subRegionEntity
import com.jaimegc.covid19tracker.ModelFactoryTest.subRegionStats
import com.jaimegc.covid19tracker.ModelFactoryTest.subRegionStatsEntity
import com.jaimegc.covid19tracker.ModelFactoryTest.worldStats
import com.jaimegc.covid19tracker.ModelFactoryTest.worldStatsEntity
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import java.util.*
class EntityMapperTest {
@Before
fun setup() {
Locale.setDefault(Locale.US)
}
@Test
fun `countryOneStats to entity`() {
assertEquals(countryEntity, countryOneStats.toEntity())
}
@Test
fun `worldStats to entity`() {
assertEquals(worldStatsEntity, worldStats.toEntity())
}
@Test
fun `stats to embedded`() {
assertEquals(stats, statsEmbedded.toDomain(stats.date))
}
@Test
fun `countryStats to entity`() {
assertEquals(countryStatsEntity, stats.toEntity(country.id))
}
@Test
fun `region to entity`() {
assertEquals(regionEntity, region.toEntity(country.id))
}
@Test
fun `subRegion to entity`() {
assertEquals(subRegionEntity, subRegion.toEntity(region.id, country.id))
}
@Test
fun `regionStats to entity`() {
assertEquals(regionStatsEntity, regionStats.toEntity(region.id, country.id))
}
@Test
fun `subRegionStats to entity`() {
assertEquals(subRegionStatsEntity, subRegionStats.toEntity(subRegion.id, region.id))
}
}