File tree 1 file changed +18
-2
lines changed
src/test/java/ru/mystamps/web/tests
1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 23
23
import java .util .List ;
24
24
import java .util .Set ;
25
25
26
+ import org .apache .commons .lang3 .StringUtils ;
27
+
26
28
import io .qala .datagen .RandomShortApi ;
27
29
28
30
import ru .mystamps .web .Db .SeriesImportRequestStatus ;
@@ -79,21 +81,35 @@ public static String name() {
79
81
}
80
82
81
83
public static String categoryName () {
82
- return between (
84
+ String name = between (
83
85
ValidationRules .CATEGORY_NAME_MIN_LENGTH ,
84
86
ValidationRules .CATEGORY_NAME_MAX_LENGTH
85
87
)
86
88
.with (oneOf (" -" ))
87
89
.english ();
90
+
91
+ if (StringUtils .startsWithAny (name , " " , "-" )
92
+ || StringUtils .endsWithAny (name , " " , "-" )) {
93
+ return countryName ();
94
+ }
95
+
96
+ return name ;
88
97
}
89
98
90
99
public static String countryName () {
91
- return between (
100
+ String name = between (
92
101
ValidationRules .COUNTRY_NAME_MIN_LENGTH ,
93
102
ValidationRules .COUNTRY_NAME_MAX_LENGTH
94
103
)
95
104
.with (oneOf (" -" ))
96
105
.english ();
106
+
107
+ if (StringUtils .startsWithAny (name , " " , "-" )
108
+ || StringUtils .endsWithAny (name , " " , "-" )) {
109
+ return countryName ();
110
+ }
111
+
112
+ return name ;
97
113
}
98
114
99
115
public static String participantName () {
You can’t perform that action at this time.
0 commit comments