File tree 3 files changed +23
-3
lines changed
main/java/ru/mystamps/web/controller
test/robotframework/series/sales
3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 30
30
31
31
import javax .servlet .http .HttpServletRequest ;
32
32
import javax .servlet .http .HttpServletResponse ;
33
- import javax .validation .Valid ;
34
33
import javax .validation .groups .Default ;
35
34
36
35
import org .apache .commons .lang3 .StringUtils ;
@@ -419,7 +418,7 @@ public String removeFromCollection(
419
418
420
419
@ PostMapping (Url .ADD_SERIES_ASK_PAGE )
421
420
public String processAskForm (
422
- @ Valid AddSeriesSalesForm form ,
421
+ @ Validated ({ Default . class , AddSeriesSalesForm . UrlChecks . class }) AddSeriesSalesForm form ,
423
422
BindingResult result ,
424
423
@ PathVariable ("id" ) Integer seriesId ,
425
424
Model model ,
Original file line number Diff line number Diff line change 20
20
import java .math .BigDecimal ;
21
21
import java .util .Date ;
22
22
23
+ import javax .validation .GroupSequence ;
23
24
import javax .validation .constraints .NotNull ;
24
25
import javax .validation .constraints .Size ;
25
26
27
+ import org .hibernate .validator .constraints .URL ;
28
+
26
29
import org .springframework .format .annotation .DateTimeFormat ;
27
30
28
31
import lombok .Getter ;
@@ -42,7 +45,12 @@ public class AddSeriesSalesForm implements AddSeriesSalesDto {
42
45
@ NotNull
43
46
private Integer sellerId ;
44
47
45
- @ Size (max = ValidationRules .SERIES_SALES_URL_MAX_LENGTH , message = "{value.too-long}" )
48
+ @ Size (
49
+ max = ValidationRules .SERIES_SALES_URL_MAX_LENGTH ,
50
+ message = "{value.too-long}" ,
51
+ groups = Group .Level1 .class
52
+ )
53
+ @ URL (groups = Group .Level2 .class )
46
54
private String url ;
47
55
48
56
@ NotNull
@@ -57,4 +65,11 @@ public class AddSeriesSalesForm implements AddSeriesSalesDto {
57
65
58
66
private Integer buyerId ;
59
67
68
+ @ GroupSequence ({
69
+ Group .Level1 .class ,
70
+ Group .Level2 .class ,
71
+ })
72
+ public interface UrlChecks {
73
+ }
74
+
60
75
}
Original file line number Diff line number Diff line change @@ -14,6 +14,12 @@ Create series sales with too long url
14
14
Submit Form id=add-series-sales-form
15
15
Element Text Should Be id=url.errors Value is greater than allowable maximum of 255 characters
16
16
17
+ Create series sales with invalid url
18
+ [Documentation] Verify validation of invalid url
19
+ Input Text id=url invalid-url
20
+ Submit Form id=add-series-sales-form
21
+ Element Text Should Be id=url.errors Value must be a valid URL
22
+
17
23
*** Keywords ***
18
24
Before Test Suite
19
25
[Documentation] Login as admin and open a page with series
You can’t perform that action at this time.
0 commit comments