1
1
package dev.shorthouse.coinwatch.data.mapper
2
2
3
3
import com.google.common.truth.Truth.assertThat
4
+ import dev.shorthouse.coinwatch.data.datastore.Currency
4
5
import dev.shorthouse.coinwatch.data.source.remote.model.CoinChartApiModel
5
6
import dev.shorthouse.coinwatch.data.source.remote.model.CoinChartData
6
7
import dev.shorthouse.coinwatch.data.source.remote.model.PastPrice
@@ -16,6 +17,8 @@ class CoinChartMapperTest {
16
17
// Class under test
17
18
private val coinChartMapper = CoinChartMapper ()
18
19
20
+ private val currency = Currency .USD
21
+
19
22
@Test
20
23
fun `When coin chart data is null should return default values` () {
21
24
// Arrange
@@ -31,7 +34,10 @@ class CoinChartMapperTest {
31
34
)
32
35
33
36
// Act
34
- val coinChart = coinChartMapper.mapApiModelToModel(apiModel)
37
+ val coinChart = coinChartMapper.mapApiModelToModel(
38
+ apiModel = apiModel,
39
+ currency = currency
40
+ )
35
41
36
42
// Assert
37
43
assertThat(coinChart).isEqualTo(expectedCoinChart)
@@ -55,7 +61,10 @@ class CoinChartMapperTest {
55
61
)
56
62
57
63
// Act
58
- val coinChart = coinChartMapper.mapApiModelToModel(apiModel)
64
+ val coinChart = coinChartMapper.mapApiModelToModel(
65
+ apiModel = apiModel,
66
+ currency = currency
67
+ )
59
68
60
69
// Assert
61
70
assertThat(coinChart).isEqualTo(expectedCoinChart)
@@ -79,7 +88,10 @@ class CoinChartMapperTest {
79
88
)
80
89
81
90
// Act
82
- val coinChart = coinChartMapper.mapApiModelToModel(apiModel)
91
+ val coinChart = coinChartMapper.mapApiModelToModel(
92
+ apiModel = apiModel,
93
+ currency = currency
94
+ )
83
95
84
96
// Assert
85
97
assertThat(coinChart).isEqualTo(expectedCoinChart)
@@ -103,7 +115,10 @@ class CoinChartMapperTest {
103
115
)
104
116
105
117
// Act
106
- val coinChart = coinChartMapper.mapApiModelToModel(apiModel)
118
+ val coinChart = coinChartMapper.mapApiModelToModel(
119
+ apiModel = apiModel,
120
+ currency = currency
121
+ )
107
122
108
123
// Assert
109
124
assertThat(coinChart).isEqualTo(expectedCoinChart)
@@ -134,7 +149,10 @@ class CoinChartMapperTest {
134
149
)
135
150
136
151
// Act
137
- val coinChart = coinChartMapper.mapApiModelToModel(apiModel)
152
+ val coinChart = coinChartMapper.mapApiModelToModel(
153
+ apiModel = apiModel,
154
+ currency = currency
155
+ )
138
156
139
157
// Assert
140
158
assertThat(coinChart).isEqualTo(expectedCoinChart)
@@ -164,7 +182,10 @@ class CoinChartMapperTest {
164
182
)
165
183
166
184
// Act
167
- val coinChart = coinChartMapper.mapApiModelToModel(apiModel)
185
+ val coinChart = coinChartMapper.mapApiModelToModel(
186
+ apiModel = apiModel,
187
+ currency = currency
188
+ )
168
189
169
190
// Assert
170
191
assertThat(coinChart).isEqualTo(expectedCoinChart)
@@ -197,7 +218,10 @@ class CoinChartMapperTest {
197
218
)
198
219
199
220
// Act
200
- val coinChart = coinChartMapper.mapApiModelToModel(apiModel)
221
+ val coinChart = coinChartMapper.mapApiModelToModel(
222
+ apiModel = apiModel,
223
+ currency = currency
224
+ )
201
225
202
226
// Assert
203
227
assertThat(coinChart).isEqualTo(expectedCoinChart)
@@ -233,7 +257,10 @@ class CoinChartMapperTest {
233
257
)
234
258
235
259
// Act
236
- val coinChart = coinChartMapper.mapApiModelToModel(apiModel)
260
+ val coinChart = coinChartMapper.mapApiModelToModel(
261
+ apiModel = apiModel,
262
+ currency = currency
263
+ )
237
264
238
265
// Assert
239
266
assertThat(coinChart).isEqualTo(expectedCoinChart)
@@ -269,7 +296,10 @@ class CoinChartMapperTest {
269
296
)
270
297
271
298
// Act
272
- val coinChart = coinChartMapper.mapApiModelToModel(apiModel)
299
+ val coinChart = coinChartMapper.mapApiModelToModel(
300
+ apiModel = apiModel,
301
+ currency = currency
302
+ )
273
303
274
304
// Assert
275
305
assertThat(coinChart).isEqualTo(expectedCoinChart)
0 commit comments