@@ -29,11 +29,10 @@ public void testParserSyntaxFailures() {
29
29
public void testEntitlementDoesNotExist () throws IOException {
30
30
PolicyParserException ppe = expectThrows (PolicyParserException .class , () -> new PolicyParser (new ByteArrayInputStream ("""
31
31
entitlement-module-name:
32
- entitlements:
33
- - does_not_exist: {}
32
+ - does_not_exist: {}
34
33
""" .getBytes (StandardCharsets .UTF_8 )), "test-failure-policy.yaml" ).parsePolicy ());
35
34
assertEquals (
36
- "[3:7 ] policy parsing error for [test-failure-policy.yaml] in scope [entitlement-module-name]: "
35
+ "[2:5 ] policy parsing error for [test-failure-policy.yaml] in scope [entitlement-module-name]: "
37
36
+ "unknown entitlement type [does_not_exist]" ,
38
37
ppe .getMessage ()
39
38
);
@@ -42,23 +41,21 @@ public void testEntitlementDoesNotExist() throws IOException {
42
41
public void testEntitlementMissingParameter () throws IOException {
43
42
PolicyParserException ppe = expectThrows (PolicyParserException .class , () -> new PolicyParser (new ByteArrayInputStream ("""
44
43
entitlement-module-name:
45
- entitlements:
46
- - file: {}
44
+ - file: {}
47
45
""" .getBytes (StandardCharsets .UTF_8 )), "test-failure-policy.yaml" ).parsePolicy ());
48
46
assertEquals (
49
- "[3:14 ] policy parsing error for [test-failure-policy.yaml] in scope [entitlement-module-name] "
47
+ "[2:12 ] policy parsing error for [test-failure-policy.yaml] in scope [entitlement-module-name] "
50
48
+ "for entitlement type [file]: missing entitlement parameter [path]" ,
51
49
ppe .getMessage ()
52
50
);
53
51
54
52
ppe = expectThrows (PolicyParserException .class , () -> new PolicyParser (new ByteArrayInputStream ("""
55
53
entitlement-module-name:
56
- entitlements:
57
- - file:
58
- path: test-path
54
+ - file:
55
+ path: test-path
59
56
""" .getBytes (StandardCharsets .UTF_8 )), "test-failure-policy.yaml" ).parsePolicy ());
60
57
assertEquals (
61
- "[5 :1] policy parsing error for [test-failure-policy.yaml] in scope [entitlement-module-name] "
58
+ "[4 :1] policy parsing error for [test-failure-policy.yaml] in scope [entitlement-module-name] "
62
59
+ "for entitlement type [file]: missing entitlement parameter [actions]" ,
63
60
ppe .getMessage ()
64
61
);
@@ -67,15 +64,14 @@ public void testEntitlementMissingParameter() throws IOException {
67
64
public void testEntitlementExtraneousParameter () throws IOException {
68
65
PolicyParserException ppe = expectThrows (PolicyParserException .class , () -> new PolicyParser (new ByteArrayInputStream ("""
69
66
entitlement-module-name:
70
- entitlements:
71
- - file:
72
- path: test-path
73
- actions:
74
- - read
75
- extra: test
67
+ - file:
68
+ path: test-path
69
+ actions:
70
+ - read
71
+ extra: test
76
72
""" .getBytes (StandardCharsets .UTF_8 )), "test-failure-policy.yaml" ).parsePolicy ());
77
73
assertEquals (
78
- "[8 :1] policy parsing error for [test-failure-policy.yaml] in scope [entitlement-module-name] "
74
+ "[7 :1] policy parsing error for [test-failure-policy.yaml] in scope [entitlement-module-name] "
79
75
+ "for entitlement type [file]: extraneous entitlement parameter(s) {extra=test}" ,
80
76
ppe .getMessage ()
81
77
);
0 commit comments