@@ -27,13 +27,12 @@ import ru.mystamps.web.dao.dto.AddCountryDbDto
27
27
import ru.mystamps.web.controller.dto.AddCountryForm
28
28
import ru.mystamps.web.dao.dto.LinkEntityDto
29
29
import ru.mystamps.web.tests.DateUtils
30
+ import ru.mystamps.web.tests.Random
30
31
import ru.mystamps.web.util.SlugUtils
31
32
32
33
@SuppressWarnings ([' ClassJavadoc' , ' MethodName' , ' NoDef' , ' NoTabCharacter' , ' TrailingWhitespace' ])
33
34
class CountryServiceImplTest extends Specification {
34
35
35
- private static final Integer USER_ID = 321
36
-
37
36
private final CountryDao countryDao = Mock ()
38
37
private final CountryService service = new CountryServiceImpl (NOPLogger . NOP_LOGGER , countryDao)
39
38
@@ -51,7 +50,7 @@ class CountryServiceImplTest extends Specification {
51
50
52
51
def " add() should throw exception when dto is null" () {
53
52
when :
54
- service. add(null , USER_ID )
53
+ service. add(null , Random . userId() )
55
54
then :
56
55
thrown IllegalArgumentException
57
56
}
@@ -60,7 +59,7 @@ class CountryServiceImplTest extends Specification {
60
59
given :
61
60
form. setName(null )
62
61
when :
63
- service. add(form, USER_ID )
62
+ service. add(form, Random . userId() )
64
63
then :
65
64
thrown IllegalArgumentException
66
65
}
@@ -82,7 +81,7 @@ class CountryServiceImplTest extends Specification {
82
81
and :
83
82
countryDao. add(_ as AddCountryDbDto ) >> expectedId
84
83
when :
85
- String actualSlug = service. add(form, USER_ID )
84
+ String actualSlug = service. add(form, Random . userId() )
86
85
then :
87
86
actualSlug == expectedSlug
88
87
}
@@ -91,7 +90,7 @@ class CountryServiceImplTest extends Specification {
91
90
given :
92
91
form. setName(null )
93
92
when :
94
- service. add(form, USER_ID )
93
+ service. add(form, Random . userId() )
95
94
then :
96
95
thrown IllegalArgumentException
97
96
}
@@ -105,7 +104,7 @@ class CountryServiceImplTest extends Specification {
105
104
and :
106
105
form. setName(name)
107
106
when :
108
- service. add(form, USER_ID )
107
+ service. add(form, Random . userId() )
109
108
then :
110
109
1 * countryDao. add({ AddCountryDbDto country ->
111
110
assert country?. slug == slug
0 commit comments