Skip to content

Commit 4ab1cfc

Browse files
committed
CollectionServiceImplTest: propagate Random.id().
Addressed to #300 No functional changes.
1 parent e30550b commit 4ab1cfc

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class CollectionServiceImplTest extends Specification {
7878
1 * collectionDao.add({ AddCollectionDbDto collection ->
7979
assert collection?.ownerId == expectedOwnerId
8080
return true
81-
}) >> 100
81+
}) >> Random.id()
8282
}
8383

8484
@SuppressWarnings(['ClosureAsLastMethodParameter', 'FactoryMethodName', 'UnnecessaryReturnKeyword'])
@@ -93,7 +93,7 @@ class CollectionServiceImplTest extends Specification {
9393
1 * collectionDao.add({ AddCollectionDbDto collection ->
9494
assert collection?.slug == expectedSlug
9595
return true
96-
}) >> 200
96+
}) >> Random.id()
9797
}
9898

9999
@SuppressWarnings(['ClosureAsLastMethodParameter', 'FactoryMethodName', 'UnnecessaryReturnKeyword'])
@@ -104,7 +104,7 @@ class CollectionServiceImplTest extends Specification {
104104
1 * collectionDao.add({ AddCollectionDbDto collection ->
105105
assert DateUtils.roughlyEqual(collection?.updatedAt, new Date())
106106
return true
107-
}) >> 300
107+
}) >> Random.id()
108108
}
109109

110110
//
@@ -113,7 +113,7 @@ class CollectionServiceImplTest extends Specification {
113113

114114
def 'addToCollection() should throw exception when user id is null'() {
115115
when:
116-
service.addToCollection(null, 456)
116+
service.addToCollection(null, Random.id())
117117
then:
118118
thrown IllegalArgumentException
119119
}
@@ -129,7 +129,7 @@ class CollectionServiceImplTest extends Specification {
129129
def 'addToCollection() should add series to collection and mark it as modified'() {
130130
given:
131131
Integer expectedUserId = Random.userId()
132-
Integer expectedSeriesId = 456
132+
Integer expectedSeriesId = Random.id()
133133
when:
134134
service.addToCollection(expectedUserId, expectedSeriesId)
135135
then:
@@ -156,7 +156,7 @@ class CollectionServiceImplTest extends Specification {
156156

157157
def 'removeFromCollection() should throw exception when user id is null'() {
158158
when:
159-
service.removeFromCollection(null, 123)
159+
service.removeFromCollection(null, Random.id())
160160
then:
161161
thrown IllegalArgumentException
162162
}
@@ -172,7 +172,7 @@ class CollectionServiceImplTest extends Specification {
172172
def 'removeFromCollection() should remove series from collection and mark it as modified'() {
173173
given:
174174
Integer expectedUserId = Random.userId()
175-
Integer expectedSeriesId = 456
175+
Integer expectedSeriesId = Random.id()
176176
when:
177177
service.removeFromCollection(expectedUserId, expectedSeriesId)
178178
then:
@@ -208,7 +208,7 @@ class CollectionServiceImplTest extends Specification {
208208
given:
209209
Integer anonymousUserId = null
210210
when:
211-
boolean serviceResult = service.isSeriesInCollection(anonymousUserId, 456)
211+
boolean serviceResult = service.isSeriesInCollection(anonymousUserId, Random.id())
212212
then:
213213
serviceResult == false
214214
and:
@@ -220,7 +220,7 @@ class CollectionServiceImplTest extends Specification {
220220
given:
221221
Integer expectedUserId = Random.userId()
222222
and:
223-
Integer expectedSeriesId = 456
223+
Integer expectedSeriesId = Random.id()
224224
and:
225225
boolean expectedResult = true
226226
when:

0 commit comments

Comments
 (0)