Skip to content

Commit c4e0f00

Browse files
committed
Suppress violations that I won't fix.
1 parent 2676eab commit c4e0f00

20 files changed

+197
-1
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import ru.mystamps.web.dao.dto.LinkEntityDto
2727
import ru.mystamps.web.tests.DateUtils
2828
import ru.mystamps.web.util.SlugUtils
2929

30+
@SuppressWarnings(['ClassJavadoc', 'MethodName', 'NoDef', 'NoTabCharacter', 'TrailingWhitespace'])
3031
class CategoryServiceImplTest extends Specification {
3132

3233
private AddCategoryForm form
@@ -92,6 +93,7 @@ class CategoryServiceImplTest extends Specification {
9293
actualSlug == expectedSlug
9394
}
9495

96+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
9597
def "add() should pass English category name to dao"() {
9698
given:
9799
String expectedCategoryName = 'Animals'
@@ -105,6 +107,7 @@ class CategoryServiceImplTest extends Specification {
105107
}) >> 20
106108
}
107109

110+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
108111
def "add() should pass Russian category name to dao"() {
109112
given:
110113
String expectedCategoryName = 'Животные'
@@ -127,6 +130,7 @@ class CategoryServiceImplTest extends Specification {
127130
thrown IllegalArgumentException
128131
}
129132

133+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
130134
def "add() should pass slug to dao"() {
131135
given:
132136
String name = '-foo123 test_'
@@ -143,6 +147,7 @@ class CategoryServiceImplTest extends Specification {
143147
}) >> 40
144148
}
145149

150+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
146151
def "add() should assign created at to current date"() {
147152
when:
148153
service.add(form, userId)
@@ -153,6 +158,7 @@ class CategoryServiceImplTest extends Specification {
153158
}) >> 50
154159
}
155160

161+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
156162
def "add() should assign updated at to current date"() {
157163
when:
158164
service.add(form, userId)
@@ -163,6 +169,7 @@ class CategoryServiceImplTest extends Specification {
163169
}) >> 60
164170
}
165171

172+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
166173
def "add() should assign created by to user"() {
167174
given:
168175
Integer expectedUserId = 10
@@ -175,6 +182,7 @@ class CategoryServiceImplTest extends Specification {
175182
}) >> 70
176183
}
177184

185+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
178186
def "add() should assign updated by to user"() {
179187
given:
180188
Integer expectedUserId = 20
@@ -207,6 +215,7 @@ class CategoryServiceImplTest extends Specification {
207215
}
208216

209217
@Unroll
218+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
210219
def "findAllAsLinkEntities(String) should pass language '#expectedLanguage' to dao"(String expectedLanguage) {
211220
when:
212221
service.findAllAsLinkEntities(expectedLanguage)
@@ -238,6 +247,7 @@ class CategoryServiceImplTest extends Specification {
238247
null | _
239248
}
240249

250+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
241251
def "findOneAsLinkEntity() should pass arguments to dao"() {
242252
given:
243253
String expectedSlug = 'people'
@@ -288,6 +298,7 @@ class CategoryServiceImplTest extends Specification {
288298
thrown IllegalArgumentException
289299
}
290300

301+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
291302
def "countCategoriesOf() should pass arguments to dao"() {
292303
given:
293304
Integer expectedCollectionId = 10
@@ -320,6 +331,7 @@ class CategoryServiceImplTest extends Specification {
320331
result == 2L
321332
}
322333

334+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
323335
def "countByName() should pass category name to dao in lowercase"() {
324336
when:
325337
service.countByName('Sport')
@@ -350,6 +362,7 @@ class CategoryServiceImplTest extends Specification {
350362
result == 2L
351363
}
352364

365+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
353366
def "countByNameRu() should pass category name to dao in lowercase"() {
354367
when:
355368
service.countByNameRu('Спорт')
@@ -371,6 +384,7 @@ class CategoryServiceImplTest extends Specification {
371384
thrown IllegalArgumentException
372385
}
373386

387+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
374388
def "countAddedSince() should invoke dao, pass argument and return result from dao"() {
375389
given:
376390
Date expectedDate = new Date()
@@ -398,6 +412,7 @@ class CategoryServiceImplTest extends Specification {
398412
thrown IllegalArgumentException
399413
}
400414

415+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
401416
def "getStatisticsOf() should pass arguments to dao"() {
402417
given:
403418
Integer expectedCollectionId = 15

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import ru.mystamps.web.dao.dto.CollectionInfoDto
2626
import ru.mystamps.web.dao.dto.UrlEntityDto
2727
import ru.mystamps.web.util.SlugUtils
2828

29+
@SuppressWarnings(['ClassJavadoc', 'MethodName', 'NoDef', 'NoTabCharacter', 'TrailingWhitespace'])
2930
class CollectionServiceImplTest extends Specification {
3031
private CollectionDao collectionDao = Mock()
3132

@@ -39,27 +40,31 @@ class CollectionServiceImplTest extends Specification {
3940
// Tests for createCollection()
4041
//
4142

43+
@SuppressWarnings('FactoryMethodName')
4244
def "createCollection() should throw exception when owner id is null"() {
4345
when:
4446
service.createCollection(null, 'test-owner-login')
4547
then:
4648
thrown IllegalArgumentException
4749
}
4850

51+
@SuppressWarnings('FactoryMethodName')
4952
def "createCollection() should throw exception when owner login is null"() {
5053
when:
5154
service.createCollection(123, null)
5255
then:
5356
thrown IllegalArgumentException
5457
}
5558

59+
@SuppressWarnings('FactoryMethodName')
5660
def "createCollection() should throw exception when owner login can't be converted to slug"() {
5761
when:
5862
service.createCollection(123, '')
5963
then:
6064
thrown IllegalArgumentException
6165
}
6266

67+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'FactoryMethodName', 'UnnecessaryReturnKeyword'])
6368
def "createCollection() should pass owner id to dao"() {
6469
given:
6570
Integer expectedOwnerId = 123
@@ -72,6 +77,7 @@ class CollectionServiceImplTest extends Specification {
7277
}) >> 100
7378
}
7479

80+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'FactoryMethodName', 'UnnecessaryReturnKeyword'])
7581
def "createCollection() should pass slugified owner login to dao"() {
7682
given:
7783
String ownerLogin = 'Test User'
@@ -104,6 +110,7 @@ class CollectionServiceImplTest extends Specification {
104110
thrown IllegalArgumentException
105111
}
106112

113+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
107114
def "addToCollection() should pass arguments to dao"() {
108115
given:
109116
Integer expectedUserId = 123
@@ -138,6 +145,7 @@ class CollectionServiceImplTest extends Specification {
138145
thrown IllegalArgumentException
139146
}
140147

148+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
141149
def "removeFromCollection() should find collection by user id"() {
142150
given:
143151
Integer expectedUserId = 123
@@ -150,6 +158,7 @@ class CollectionServiceImplTest extends Specification {
150158
}) >> TestObjects.createUrlEntityDto()
151159
}
152160

161+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
153162
def "removeFromCollection() should remove series from collection"() {
154163
given:
155164
Integer expectedSeriesId = 456
@@ -204,6 +213,7 @@ class CollectionServiceImplTest extends Specification {
204213
0 * collectionDao.isSeriesInUserCollection(_ as Integer, _ as Integer)
205214
}
206215

216+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
207217
def "isSeriesInCollection() should pass arguments to dao"() {
208218
given:
209219
Integer expectedUserId = 123
@@ -256,6 +266,7 @@ class CollectionServiceImplTest extends Specification {
256266
0 | _
257267
}
258268

269+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
259270
def "findRecentlyCreated() should pass arguments to dao"() {
260271
given:
261272
int expectedQuantity = 4
@@ -279,6 +290,7 @@ class CollectionServiceImplTest extends Specification {
279290
thrown IllegalArgumentException
280291
}
281292

293+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
282294
def "findBySlug() should invoke dao, pass argument and return result from dao"() {
283295
given:
284296
String expectedSlug = 'cuba'

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import ru.mystamps.web.dao.dto.UrlEntityDto
2828
import ru.mystamps.web.tests.DateUtils
2929
import ru.mystamps.web.util.SlugUtils
3030

31+
@SuppressWarnings(['ClassJavadoc', 'MethodName', 'NoDef', 'NoTabCharacter', 'TrailingWhitespace'])
3132
class CountryServiceImplTest extends Specification {
3233

3334
private AddCountryForm form
@@ -93,6 +94,7 @@ class CountryServiceImplTest extends Specification {
9394
actualSlug == expectedSlug
9495
}
9596

97+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
9698
def "add() should pass country name in English to dao"() {
9799
given:
98100
String expectedCountryName = 'Italy'
@@ -106,6 +108,7 @@ class CountryServiceImplTest extends Specification {
106108
}) >> 20
107109
}
108110

111+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
109112
def "add() should pass country name in Russian to dao"() {
110113
given:
111114
String expectedCountryName = 'Италия'
@@ -128,6 +131,7 @@ class CountryServiceImplTest extends Specification {
128131
thrown IllegalArgumentException
129132
}
130133

134+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
131135
def "add() should pass slug to dao"() {
132136
given:
133137
String name = '-foo123 test_'
@@ -144,6 +148,7 @@ class CountryServiceImplTest extends Specification {
144148
}) >> 40
145149
}
146150

151+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
147152
def "add() should assign created at to current date"() {
148153
when:
149154
service.add(form, userId)
@@ -154,6 +159,7 @@ class CountryServiceImplTest extends Specification {
154159
}) >> 50
155160
}
156161

162+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
157163
def "add() should assign updated at to current date"() {
158164
when:
159165
service.add(form, userId)
@@ -164,6 +170,7 @@ class CountryServiceImplTest extends Specification {
164170
}) >> 60
165171
}
166172

173+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
167174
def "add() should assign created by to user"() {
168175
given:
169176
Integer expectedUserId = 10
@@ -176,6 +183,7 @@ class CountryServiceImplTest extends Specification {
176183
}) >> 70
177184
}
178185

186+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
179187
def "add() should assign updated by to user"() {
180188
given:
181189
Integer expectedUserId = 10
@@ -208,6 +216,7 @@ class CountryServiceImplTest extends Specification {
208216
}
209217

210218
@Unroll
219+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
211220
def "findAllAsLinkEntities(String) should pass language '#expectedLanguage' to dao"(String expectedLanguage) {
212221
when:
213222
service.findAllAsLinkEntities(expectedLanguage)
@@ -238,6 +247,7 @@ class CountryServiceImplTest extends Specification {
238247
null | _
239248
}
240249

250+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
241251
def "findOneAsLinkEntity() should pass arguments to dao"() {
242252
given:
243253
String expectedSlug = 'france'
@@ -288,6 +298,7 @@ class CountryServiceImplTest extends Specification {
288298
thrown IllegalArgumentException
289299
}
290300

301+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
291302
def "countCountriesOf() should pass arguments to dao"() {
292303
given:
293304
Integer expectedCollectionId = 9
@@ -320,6 +331,7 @@ class CountryServiceImplTest extends Specification {
320331
result == 2L
321332
}
322333

334+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
323335
def "countByName() should pass country name to dao in lowercase"() {
324336
when:
325337
service.countByName('Canada')
@@ -350,6 +362,7 @@ class CountryServiceImplTest extends Specification {
350362
result == 2L
351363
}
352364

365+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
353366
def "countByNameRu() should pass category name to dao in lowercase"() {
354367
when:
355368
service.countByNameRu('Канада')
@@ -371,6 +384,7 @@ class CountryServiceImplTest extends Specification {
371384
thrown IllegalArgumentException
372385
}
373386

387+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
374388
def "countAddedSince() should invoke dao, pass argument and return result from dao"() {
375389
given:
376390
Date expectedDate = new Date()
@@ -398,6 +412,7 @@ class CountryServiceImplTest extends Specification {
398412
thrown IllegalArgumentException
399413
}
400414

415+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
401416
def "getStatisticsOf() should pass arguments to dao"() {
402417
given:
403418
Integer expectedCollectionId = 17

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import spock.lang.Specification
2222
import ru.mystamps.web.dao.dto.UsersActivationFullDto
2323
import ru.mystamps.web.service.dto.AdminDailyReport
2424

25+
@SuppressWarnings(['ClassJavadoc', 'MethodName', 'NoDef', 'NoTabCharacter', 'TrailingWhitespace'])
2526
class CronServiceImplTest extends Specification {
2627

2728
private CategoryService categoryService = Mock()
@@ -71,6 +72,7 @@ class CronServiceImplTest extends Specification {
7172
// Tests for sendDailyStatistics()
7273
//
7374

75+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
7476
def "sendDailyStatistics() should invoke services and pass start date to them"() {
7577
when:
7678
service.sendDailyStatistics()
@@ -117,6 +119,7 @@ class CronServiceImplTest extends Specification {
117119
})
118120
}
119121

122+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
120123
def "sendDailyStatistics() should prepare report and pass it to mail service"() {
121124
given:
122125
categoryService.countAddedSince(_ as Date) >> 1
@@ -164,6 +167,7 @@ class CronServiceImplTest extends Specification {
164167
1 * usersActivationService.findOlderThan(_ as Integer) >> []
165168
}
166169

170+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
167171
def "purgeUsersActivations() should pass days to service"() {
168172
given:
169173
int expectedDays = CronService.PURGE_AFTER_DAYS

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import ru.mystamps.web.dao.dto.ImageDto
2727
import ru.mystamps.web.dao.dto.ImageInfoDto
2828
import ru.mystamps.web.service.exception.ImagePersistenceException
2929

30+
@SuppressWarnings(['ClassJavadoc', 'MethodName', 'NoDef', 'NoTabCharacter', 'TrailingWhitespace'])
3031
class DatabaseImagePersistenceStrategyTest extends Specification {
3132

3233
private ImageDataDao imageDataDao = Mock()
@@ -50,6 +51,7 @@ class DatabaseImagePersistenceStrategyTest extends Specification {
5051
ex.cause instanceof IOException
5152
}
5253

54+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
5355
def "save() should pass file content to image data dao"() {
5456
given:
5557
byte[] expected = 'test'.bytes
@@ -63,6 +65,7 @@ class DatabaseImagePersistenceStrategyTest extends Specification {
6365
})
6466
}
6567

68+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
6669
def "save() should pass image to image data dao"() {
6770
given:
6871
Integer expectedImageId = imageInfoDto.id
@@ -79,6 +82,7 @@ class DatabaseImagePersistenceStrategyTest extends Specification {
7982
// Tests for get()
8083
//
8184

85+
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
8286
def "get() should pass image to image data dao"() {
8387
given:
8488
Integer expectedImageId = imageInfoDto.id

0 commit comments

Comments
 (0)