File tree 2 files changed +29
-1
lines changed
main/java/ru/mystamps/web/service
test/groovy/ru/mystamps/web/service
2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -281,7 +281,6 @@ public BigDecimal extractPrice(String fragment) {
281
281
}
282
282
}
283
283
284
- // @todo #695 SeriesInfoExtractorServiceImpl.extractCurrency(): add unit tests
285
284
public String extractCurrency (String fragment ) {
286
285
if (StringUtils .isBlank (fragment )) {
287
286
return null ;
Original file line number Diff line number Diff line change @@ -309,4 +309,33 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
309
309
' part of word2000' | _
310
310
}
311
311
312
+ //
313
+ // Tests for extractCurrency()
314
+ //
315
+
316
+ def ' extractCurrency() should return null when fragment is null, empty or blank' () {
317
+ when :
318
+ String result = service. extractCurrency(nullOrBlank())
319
+ then :
320
+ result == null
321
+ }
322
+
323
+ def ' extractCurrency() should return null for unknown currency' () {
324
+ given :
325
+ String invalidCurrency = ' CAD'
326
+ when :
327
+ String result = service. extractCurrency(invalidCurrency)
328
+ then :
329
+ result == null
330
+ }
331
+
332
+ def ' extractCurrency() should extract currency from a fragment' () {
333
+ given :
334
+ String validCurrency = Random . currency()
335
+ when :
336
+ String result = service. extractCurrency(validCurrency)
337
+ then :
338
+ result == validCurrency
339
+ }
340
+
312
341
}
You can’t perform that action at this time.
0 commit comments