@@ -57,15 +57,15 @@ class CategoryServiceImplTest extends Specification {
57
57
// Tests for add()
58
58
//
59
59
60
- def " add() should throw exception when dto is null" () {
60
+ def ' add() should throw exception when dto is null' () {
61
61
when :
62
62
service. add(null , Random . userId())
63
63
then :
64
64
IllegalArgumentException ex = thrown()
65
65
ex. message == ' DTO must be non null'
66
66
}
67
67
68
- def " add() should throw exception when English category name is null" () {
68
+ def ' add() should throw exception when English category name is null' () {
69
69
given :
70
70
form. setName(null )
71
71
when :
@@ -75,15 +75,15 @@ class CategoryServiceImplTest extends Specification {
75
75
ex. message == ' Category name in English must be non null'
76
76
}
77
77
78
- def " add() should throw exception when user is null" () {
78
+ def ' add() should throw exception when user is null' () {
79
79
when :
80
80
service. add(form, null )
81
81
then :
82
82
IllegalArgumentException ex = thrown()
83
83
ex. message == ' User id must be non null'
84
84
}
85
85
86
- def " add() should call dao" () {
86
+ def ' add() should call dao' () {
87
87
given :
88
88
Integer expectedId = 10
89
89
and :
@@ -109,7 +109,7 @@ class CategoryServiceImplTest extends Specification {
109
109
}
110
110
111
111
@SuppressWarnings ([' ClosureAsLastMethodParameter' , ' UnnecessaryReturnKeyword' ])
112
- def " add() should pass slug to dao" () {
112
+ def ' add() should pass slug to dao' () {
113
113
given :
114
114
String name = ' -foo123 test_'
115
115
and :
@@ -126,7 +126,7 @@ class CategoryServiceImplTest extends Specification {
126
126
}
127
127
128
128
@SuppressWarnings ([' ClosureAsLastMethodParameter' , ' UnnecessaryReturnKeyword' ])
129
- def " add() should pass values to dao" () {
129
+ def ' add() should pass values to dao' () {
130
130
given :
131
131
Integer expectedUserId = 10
132
132
String expectedEnglishName = ' Animals'
@@ -221,7 +221,7 @@ class CategoryServiceImplTest extends Specification {
221
221
// Tests for findAllAsLinkEntities(String)
222
222
//
223
223
224
- def " findAllAsLinkEntities(String) should call dao" () {
224
+ def ' findAllAsLinkEntities(String) should call dao' () {
225
225
given :
226
226
LinkEntityDto category1 = new LinkEntityDto (1 , ' first-category' , ' First Category' )
227
227
and :
@@ -289,7 +289,7 @@ class CategoryServiceImplTest extends Specification {
289
289
' ' | _
290
290
}
291
291
292
- def " findOneAsLinkEntity() should pass arguments to dao" () {
292
+ def ' findOneAsLinkEntity() should pass arguments to dao' () {
293
293
given :
294
294
String expectedSlug = ' people'
295
295
and :
@@ -308,7 +308,7 @@ class CategoryServiceImplTest extends Specification {
308
308
// Tests for countAll()
309
309
//
310
310
311
- def " countAll() should call dao and returns result" () {
311
+ def ' countAll() should call dao and returns result' () {
312
312
given :
313
313
long expectedResult = 10
314
314
when :
@@ -323,15 +323,15 @@ class CategoryServiceImplTest extends Specification {
323
323
// Tests for countCategoriesOf()
324
324
//
325
325
326
- def " countCategoriesOf() should throw exception when collection id is null" () {
326
+ def ' countCategoriesOf() should throw exception when collection id is null' () {
327
327
when :
328
328
service. countCategoriesOf(null )
329
329
then :
330
330
IllegalArgumentException ex = thrown()
331
331
ex. message == ' Collection id must be non null'
332
332
}
333
333
334
- def " countCategoriesOf() should pass arguments to dao" () {
334
+ def ' countCategoriesOf() should pass arguments to dao' () {
335
335
given :
336
336
Integer expectedCollectionId = 10
337
337
when :
@@ -344,15 +344,15 @@ class CategoryServiceImplTest extends Specification {
344
344
// Tests for countBySlug()
345
345
//
346
346
347
- def " countBySlug() should throw exception when slug is null" () {
347
+ def ' countBySlug() should throw exception when slug is null' () {
348
348
when :
349
349
service. countBySlug(null )
350
350
then :
351
351
IllegalArgumentException ex = thrown()
352
352
ex. message == ' Category slug must be non null'
353
353
}
354
354
355
- def " countBySlug() should call dao" () {
355
+ def ' countBySlug() should call dao' () {
356
356
given :
357
357
categoryDao. countBySlug(_ as String ) >> 3L
358
358
when :
@@ -365,15 +365,15 @@ class CategoryServiceImplTest extends Specification {
365
365
// Tests for countByName()
366
366
//
367
367
368
- def " countByName() should throw exception when name is null" () {
368
+ def ' countByName() should throw exception when name is null' () {
369
369
when :
370
370
service. countByName(null )
371
371
then :
372
372
IllegalArgumentException ex = thrown()
373
373
ex. message == ' Name must be non null'
374
374
}
375
375
376
- def " countByName() should call dao" () {
376
+ def ' countByName() should call dao' () {
377
377
given :
378
378
categoryDao. countByName(_ as String ) >> 2L
379
379
when :
@@ -382,7 +382,7 @@ class CategoryServiceImplTest extends Specification {
382
382
result == 2L
383
383
}
384
384
385
- def " countByName() should pass category name to dao in lowercase" () {
385
+ def ' countByName() should pass category name to dao in lowercase' () {
386
386
when :
387
387
service. countByName(' Sport' )
388
388
then :
@@ -393,15 +393,15 @@ class CategoryServiceImplTest extends Specification {
393
393
// Tests for countByNameRu()
394
394
//
395
395
396
- def " countByNameRu() should throw exception when name is null" () {
396
+ def ' countByNameRu() should throw exception when name is null' () {
397
397
when :
398
398
service. countByNameRu(null )
399
399
then :
400
400
IllegalArgumentException ex = thrown()
401
401
ex. message == ' Name in Russian must be non null'
402
402
}
403
403
404
- def " countByNameRu() should call dao" () {
404
+ def ' countByNameRu() should call dao' () {
405
405
given :
406
406
categoryDao. countByNameRu(_ as String ) >> 2L
407
407
when :
@@ -410,7 +410,7 @@ class CategoryServiceImplTest extends Specification {
410
410
result == 2L
411
411
}
412
412
413
- def " countByNameRu() should pass category name to dao in lowercase" () {
413
+ def ' countByNameRu() should pass category name to dao in lowercase' () {
414
414
when :
415
415
service. countByNameRu(' Спорт' )
416
416
then :
@@ -421,15 +421,15 @@ class CategoryServiceImplTest extends Specification {
421
421
// Tests for countAddedSince()
422
422
//
423
423
424
- def " countAddedSince() should throw exception when date is null" () {
424
+ def ' countAddedSince() should throw exception when date is null' () {
425
425
when :
426
426
service. countAddedSince(null )
427
427
then :
428
428
IllegalArgumentException ex = thrown()
429
429
ex. message == ' Date must be non null'
430
430
}
431
431
432
- def " countAddedSince() should invoke dao, pass argument and return result from dao" () {
432
+ def ' countAddedSince() should invoke dao, pass argument and return result from dao' () {
433
433
given :
434
434
Date expectedDate = new Date ()
435
435
and :
@@ -446,15 +446,15 @@ class CategoryServiceImplTest extends Specification {
446
446
// Tests for countUntranslatedNamesSince()
447
447
//
448
448
449
- def " countUntranslatedNamesSince() should throw exception when date is null" () {
449
+ def ' countUntranslatedNamesSince() should throw exception when date is null' () {
450
450
when :
451
451
service. countUntranslatedNamesSince(null )
452
452
then :
453
453
IllegalArgumentException ex = thrown()
454
454
ex. message == ' Date must be non null'
455
455
}
456
456
457
- def " countUntranslatedNamesSince() should invoke dao, pass argument and return result from dao" () {
457
+ def ' countUntranslatedNamesSince() should invoke dao, pass argument and return result from dao' () {
458
458
given :
459
459
Date expectedDate = new Date ()
460
460
and :
@@ -471,15 +471,15 @@ class CategoryServiceImplTest extends Specification {
471
471
// Tests for getStatisticsOf()
472
472
//
473
473
474
- def " getStatisticsOf() should throw exception when collection id is null" () {
474
+ def ' getStatisticsOf() should throw exception when collection id is null' () {
475
475
when :
476
476
service. getStatisticsOf(null , ' whatever' )
477
477
then :
478
478
IllegalArgumentException ex = thrown()
479
479
ex. message == ' Collection id must be non null'
480
480
}
481
481
482
- def " getStatisticsOf() should pass arguments to dao" () {
482
+ def ' getStatisticsOf() should pass arguments to dao' () {
483
483
given :
484
484
Integer expectedCollectionId = 15
485
485
and :
0 commit comments