File tree Expand file tree Collapse file tree
main/java/com/retailsvc/http/spec/schema
test/java/com/retailsvc/http/spec/schema Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package com .retailsvc .http .spec .schema ;
2+
3+ public sealed interface AdditionalProperties {
4+ record Allowed () implements AdditionalProperties {}
5+
6+ record Forbidden () implements AdditionalProperties {}
7+
8+ record SchemaConstraint (Schema schema ) implements AdditionalProperties {}
9+ }
Original file line number Diff line number Diff line change 1+ package com .retailsvc .http .spec .schema ;
2+
3+ import java .util .Set ;
4+
5+ public record BooleanSchema (Set <TypeName > types ) implements Schema {}
Original file line number Diff line number Diff line change 1+ package com .retailsvc .http .spec .schema ;
2+
3+ import java .util .Set ;
4+
5+ public sealed interface Schema permits BooleanSchema {
6+ Set <TypeName > types ();
7+ }
Original file line number Diff line number Diff line change 1+ package com .retailsvc .http .spec .schema ;
2+
3+ import static org .assertj .core .api .Assertions .assertThat ;
4+
5+ import java .util .Set ;
6+ import org .junit .jupiter .api .Test ;
7+
8+ class AdditionalPropertiesTest {
9+ @ Test
10+ void allowedIsDefault () {
11+ AdditionalProperties ap = new AdditionalProperties .Allowed ();
12+ assertThat (ap ).isInstanceOf (AdditionalProperties .Allowed .class );
13+ }
14+
15+ @ Test
16+ void forbiddenSentinel () {
17+ assertThat (new AdditionalProperties .Forbidden ())
18+ .isInstanceOf (AdditionalProperties .Forbidden .class );
19+ }
20+
21+ @ Test
22+ void schemaConstraintCarriesSchema () {
23+ Schema inner = new BooleanSchema (Set .of (TypeName .BOOLEAN ));
24+ AdditionalProperties ap = new AdditionalProperties .SchemaConstraint (inner );
25+ assertThat (((AdditionalProperties .SchemaConstraint ) ap ).schema ()).isSameAs (inner );
26+ }
27+ }
You can’t perform that action at this time.
0 commit comments