38
38
import ru .mystamps .web .util .SlugUtils ;
39
39
40
40
import static io .qala .datagen .RandomShortApi .bool ;
41
+ import static io .qala .datagen .RandomShortApi .nullOr ;
41
42
42
43
public final class TestObjects {
43
44
public static final String TEST_ACTIVITY_TYPE = "EventType" ;
@@ -54,8 +55,6 @@ public final class TestObjects {
54
55
protected static final String TEST_PASSWORD = "secret" ;
55
56
56
57
private static final String TEST_NAME = "Test Name" ;
57
- private static final String TEST_LOGIN = "test" ;
58
-
59
58
private static final String TEST_URL = "test.example.org" ;
60
59
private static final BigDecimal TEST_PRICE = new BigDecimal ("100.99" );
61
60
@@ -72,7 +71,7 @@ public static UsersActivationFullDto createUsersActivationFullDto() {
72
71
UsersActivationFullDto activation = new UsersActivationFullDto (
73
72
TEST_ACTIVATION_KEY ,
74
73
TEST_EMAIL ,
75
- new Date ()
74
+ Random . date ()
76
75
);
77
76
return activation ;
78
77
}
@@ -87,27 +86,25 @@ public static LinkEntityDto createLinkEntityDto() {
87
86
88
87
public static AddUserDbDto createAddUserDbDto () {
89
88
AddUserDbDto user = new AddUserDbDto ();
90
- user .setLogin (TEST_LOGIN );
89
+ user .setLogin (Random . login () );
91
90
user .setRole (UserDetails .Role .USER );
92
91
user .setName (TEST_NAME );
93
92
user .setEmail (TEST_EMAIL );
94
- user .setRegisteredAt (new Date ());
95
- user .setActivatedAt (new Date ());
93
+ user .setRegisteredAt (Random . date ());
94
+ user .setActivatedAt (Random . date ());
96
95
user .setHash (TEST_HASH );
97
96
98
97
return user ;
99
98
}
100
99
101
100
public static UserDetails createUserDetails () {
102
- String collectionSlug = TEST_LOGIN ;
103
-
104
101
return new UserDetails (
105
102
Random .userId (),
106
- TEST_LOGIN ,
103
+ Random . login () ,
107
104
TEST_NAME ,
108
105
TEST_HASH ,
109
106
UserDetails .Role .USER ,
110
- collectionSlug
107
+ Random . collectionSlug ()
111
108
);
112
109
}
113
110
@@ -120,18 +117,21 @@ public static DbImageDto createDbImageDto() {
120
117
}
121
118
122
119
public static SitemapInfoDto createSitemapInfoDto () {
123
- return new SitemapInfoDto (Random .id (), new Date ());
120
+ return new SitemapInfoDto (Random .id (), Random . date ());
124
121
}
125
122
126
123
@ SuppressWarnings ("checkstyle:magicnumber" )
127
124
public static SeriesInfoDto createSeriesInfoDto () {
125
+ String category = Random .categoryName ();
126
+ String country = Random .countryName ();
127
+
128
128
return new SeriesInfoDto (
129
129
Random .id (),
130
- new LinkEntityDto (Random .id (), "test- category" , "Test Category" ),
131
- new LinkEntityDto (Random .id (), "test- country" , "Test Country" ),
130
+ new LinkEntityDto (Random .id (), SlugUtils . slugify ( category ), category ),
131
+ new LinkEntityDto (Random .id (), SlugUtils . slugify ( country ), country ),
132
132
15 , 10 , Random .issueYear (),
133
133
16 ,
134
- bool ()
134
+ Random . perforated ()
135
135
);
136
136
}
137
137
@@ -146,17 +146,17 @@ public static SeriesFullInfoDto createSeriesFullInfoDto() {
146
146
info .getPerforated (),
147
147
"this is a full info" ,
148
148
Random .userId (),
149
- TEST_PRICE ,
150
- TEST_PRICE ,
151
- TEST_PRICE ,
152
- TEST_PRICE ,
153
- Random .price (),
154
- Random .price ()
149
+ nullOr ( Random . price ()) ,
150
+ nullOr ( Random . price ()) ,
151
+ nullOr ( Random . price ()) ,
152
+ nullOr ( Random . price ()) ,
153
+ nullOr ( Random .price () ),
154
+ nullOr ( Random .price () )
155
155
);
156
156
}
157
157
158
158
public static CollectionInfoDto createCollectionInfoDto () {
159
- return new CollectionInfoDto (Random .id (), "test-user" , "Test User" );
159
+ return new CollectionInfoDto (Random .id (), Random . collectionSlug () , "Test User" );
160
160
}
161
161
162
162
public static SeriesInCollectionWithPriceDto createSeriesInCollectionWithPriceDto () {
@@ -190,16 +190,16 @@ public static SuspiciousActivityDto createSuspiciousActivityDto() {
190
190
*/
191
191
public static PurchaseAndSaleDto createPurchaseAndSaleDto () {
192
192
return new PurchaseAndSaleDto (
193
- new Date (),
193
+ Random . date (),
194
194
TEST_NAME ,
195
195
TEST_URL ,
196
196
TEST_NAME ,
197
197
TEST_URL ,
198
198
TEST_URL ,
199
- TEST_PRICE ,
200
- Currency . RUB ,
201
- TEST_PRICE ,
202
- Currency . USD
199
+ Random . price () ,
200
+ Random . currency () ,
201
+ Random . price () ,
202
+ Random . currency ()
203
203
);
204
204
}
205
205
@@ -208,7 +208,7 @@ public static EntityWithIdDto createEntityWithIdDto() {
208
208
}
209
209
210
210
public static ImportRequestDto createImportRequestDto () {
211
- return new ImportRequestDto (Random .url (), Random .importRequestStatus (), null );
211
+ return new ImportRequestDto (Random .url (), Random .importRequestStatus (), Random . id () );
212
212
}
213
213
214
214
public static SeriesParsedDataDto createSeriesParsedDataDto () {
0 commit comments