Total Lines | 21 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | package test |
||
2 | |||
3 | import ( |
||
4 | "testing" |
||
5 | |||
6 | "github.com/muonsoft/validation/code" |
||
7 | "github.com/muonsoft/validation/it" |
||
8 | "github.com/muonsoft/validation/message" |
||
9 | "github.com/muonsoft/validation/validator" |
||
10 | ) |
||
11 | |||
12 | func TestValidate_AtProperty_WhenGivenProperty_ExpectViolationWithProperty(t *testing.T) { |
||
13 | err := validator.AtProperty("property").ValidateString(stringValue(""), it.IsNotBlank()) |
||
14 | |||
15 | assertHasOneViolation(code.NotBlank, message.NotBlank, "property")(t, err) |
||
16 | } |
||
17 | |||
18 | func TestValidate_AtIndex_WhenGivenIndex_ExpectViolationWithIndex(t *testing.T) { |
||
19 | err := validator.AtIndex(1).ValidateString(stringValue(""), it.IsNotBlank()) |
||
20 | |||
21 | assertHasOneViolation(code.NotBlank, message.NotBlank, "[1]")(t, err) |
||
22 | } |
||
23 |