Skip to content

Commit 915f84a

Browse files
committed
Remove fixed currency values from service and dao code.
Addressed to #778 No functional changes.
1 parent b77591b commit 915f84a

File tree

5 files changed

+24
-61
lines changed

5 files changed

+24
-61
lines changed

src/main/java/ru/mystamps/web/dao/dto/AddSeriesDbDto.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,9 @@ public class AddSeriesDbDto {
3636
private Boolean perforated;
3737

3838
private BigDecimal michelPrice;
39-
private String michelCurrency;
40-
4139
private BigDecimal scottPrice;
42-
private String scottCurrency;
43-
4440
private BigDecimal yvertPrice;
45-
private String yvertCurrency;
46-
4741
private BigDecimal gibbonsPrice;
48-
private String gibbonsCurrency;
49-
5042
private BigDecimal solovyovPrice;
5143
private BigDecimal zagorskiPrice;
5244

src/main/java/ru/mystamps/web/dao/impl/JdbcSeriesDao.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,9 @@ public Integer add(AddSeriesDbDto series) {
127127
params.put("release_month", series.getReleaseMonth());
128128
params.put("release_year", series.getReleaseYear());
129129
params.put("michel_price", series.getMichelPrice());
130-
params.put("michel_currency", series.getMichelCurrency());
131130
params.put("scott_price", series.getScottPrice());
132-
params.put("scott_currency", series.getScottCurrency());
133131
params.put("yvert_price", series.getYvertPrice());
134-
params.put("yvert_currency", series.getYvertCurrency());
135132
params.put("gibbons_price", series.getGibbonsPrice());
136-
params.put("gibbons_currency", series.getGibbonsCurrency());
137133
params.put("solovyov_price", series.getSolovyovPrice());
138134
params.put("zagorski_price", series.getZagorskiPrice());
139135
params.put("comment", series.getComment());

src/main/java/ru/mystamps/web/service/SeriesServiceImpl.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434

3535
import ru.mystamps.web.dao.SeriesDao;
3636
import ru.mystamps.web.dao.dto.AddSeriesDbDto;
37-
import ru.mystamps.web.dao.dto.Currency;
3837
import ru.mystamps.web.dao.dto.ImageInfoDto;
3938
import ru.mystamps.web.dao.dto.PurchaseAndSaleDto;
4039
import ru.mystamps.web.dao.dto.SeriesFullInfoDto;
@@ -92,22 +91,18 @@ public Integer add(AddSeriesDto dto, Integer userId, boolean userCanAddComments)
9291

9392
if (dto.getMichelPrice() != null) {
9493
series.setMichelPrice(dto.getMichelPrice());
95-
series.setMichelCurrency(Currency.EUR.toString());
9694
}
9795

9896
if (dto.getScottPrice() != null) {
9997
series.setScottPrice(dto.getScottPrice());
100-
series.setScottCurrency(Currency.USD.toString());
10198
}
10299

103100
if (dto.getYvertPrice() != null) {
104101
series.setYvertPrice(dto.getYvertPrice());
105-
series.setYvertCurrency(Currency.EUR.toString());
106102
}
107103

108104
if (dto.getGibbonsPrice() != null) {
109105
series.setGibbonsPrice(dto.getGibbonsPrice());
110-
series.setGibbonsCurrency(Currency.GBP.toString());
111106
}
112107

113108
if (dto.getSolovyovPrice() != null) {

src/main/resources/sql/series_dao_queries.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ VALUES \
3333
, :release_month \
3434
, :release_year \
3535
, :michel_price \
36-
, :michel_currency \
36+
, 'EUR' \
3737
, :scott_price \
38-
, :scott_currency \
38+
, 'USD' \
3939
, :yvert_price \
40-
, :yvert_currency \
40+
, 'EUR' \
4141
, :gibbons_price \
42-
, :gibbons_currency \
42+
, 'GBP' \
4343
, :solovyov_price \
4444
, :zagorski_price \
4545
, :comment \

src/test/groovy/ru/mystamps/web/service/SeriesServiceImplTest.groovy

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -231,95 +231,75 @@ class SeriesServiceImplTest extends Specification {
231231
}
232232

233233
@Unroll
234-
@SuppressWarnings([
235-
'ClosureAsLastMethodParameter',
236-
'UnnecessaryReturnKeyword',
237-
'LineLength',
238-
])
239-
def "add() should pass michel price (#expectedPrice) and currency (#expectedCurrency) to series dao"(BigDecimal expectedPrice, String expectedCurrency) {
234+
@SuppressWarnings([ 'ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword' ])
235+
def 'add() should pass michel price (#expectedPrice) to series dao'(BigDecimal expectedPrice) {
240236
given:
241237
form.setMichelPrice(expectedPrice)
242238
when:
243239
service.add(form, Random.userId(), bool())
244240
then:
245241
1 * seriesDao.add({ AddSeriesDbDto series ->
246242
assert series?.michelPrice == expectedPrice
247-
assert series?.michelCurrency == expectedCurrency
248243
return true
249244
}) >> Random.id()
250245
where:
251-
expectedPrice | expectedCurrency
252-
Random.price() | Currency.EUR.toString()
253-
null | null
246+
expectedPrice | _
247+
Random.price() | _
248+
null | _
254249
}
255250

256251
@Unroll
257-
@SuppressWarnings([
258-
'ClosureAsLastMethodParameter',
259-
'LineLength',
260-
'UnnecessaryReturnKeyword',
261-
])
262-
def "add() should pass scott price (#expectedPrice) and currency (#expectedCurrency) to series dao"(BigDecimal expectedPrice, String expectedCurrency) {
252+
@SuppressWarnings([ 'ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword' ])
253+
def 'add() should pass scott price (#expectedPrice) to series dao'(BigDecimal expectedPrice) {
263254
given:
264255
form.setScottPrice(expectedPrice)
265256
when:
266257
service.add(form, Random.userId(), bool())
267258
then:
268259
1 * seriesDao.add({ AddSeriesDbDto series ->
269260
assert series?.scottPrice == expectedPrice
270-
assert series?.scottCurrency == expectedCurrency
271261
return true
272262
}) >> Random.id()
273263
where:
274-
expectedPrice | expectedCurrency
275-
Random.price() | Currency.USD.toString()
276-
null | null
264+
expectedPrice | _
265+
Random.price() | _
266+
null | _
277267
}
278268

279269
@Unroll
280-
@SuppressWarnings([
281-
'ClosureAsLastMethodParameter',
282-
'LineLength',
283-
'UnnecessaryReturnKeyword',
284-
])
285-
def "add() should pass yvert price (#expectedPrice) and currency (#expectedCurrency) to series dao"(BigDecimal expectedPrice, String expectedCurrency) {
270+
@SuppressWarnings([ 'ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword' ])
271+
def 'add() should pass yvert price (#expectedPrice) to series dao'(BigDecimal expectedPrice) {
286272
given:
287273
form.setYvertPrice(expectedPrice)
288274
when:
289275
service.add(form, Random.userId(), bool())
290276
then:
291277
1 * seriesDao.add({ AddSeriesDbDto series ->
292278
assert series?.yvertPrice == expectedPrice
293-
assert series?.yvertCurrency == expectedCurrency
294279
return true
295280
}) >> Random.id()
296281
where:
297-
expectedPrice | expectedCurrency
298-
Random.price() | Currency.EUR.toString()
299-
null | null
282+
expectedPrice | _
283+
Random.price() | _
284+
null | _
300285
}
301286

302287
@Unroll
303-
@SuppressWarnings([
304-
'ClosureAsLastMethodParameter',
305-
'LineLength',
306-
'UnnecessaryReturnKeyword',
307-
])
308-
def "add() should pass gibbons price (#expectedPrice) and currency (#expectedCurrency) to series dao"(BigDecimal expectedPrice, String expectedCurrency) {
288+
@SuppressWarnings([ 'ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword' ])
289+
def 'add() should pass gibbons price (#expectedPrice) to series dao'(BigDecimal expectedPrice) {
309290
given:
310291
form.setGibbonsPrice(expectedPrice)
311292
when:
312293
service.add(form, Random.userId(), bool())
313294
then:
314295
1 * seriesDao.add({ AddSeriesDbDto series ->
315296
assert series?.gibbonsPrice == expectedPrice
316-
assert series?.gibbonsCurrency == expectedCurrency
317297
return true
318298
}) >> Random.id()
319299
where:
320-
expectedPrice | expectedCurrency
321-
Random.price() | Currency.GBP.toString()
322-
null | null
300+
expectedPrice | _
301+
Random.price() | _
302+
null | _
323303
}
324304

325305
@Unroll

0 commit comments

Comments
 (0)