@@ -19,8 +19,8 @@ import io.openapiprocessor.jsonschema.schema.Bucket
1919import io.openapiprocessor.jsonschema.schema.Bucket.createBucket
2020import io.openapiprocessor.jsonschema.schema.SchemaVersion
2121import io.openapiprocessor.jsonschema.schema.Scope
22- import io.openapiprocessor.jsonschema.schema.Scope.empty
23- import java.net.URI
22+ import io.openapiprocessor.jsonschema.schema.Scope.createScope
23+ import io.openapiprocessor.jsonschema.schema.UriSupport.createUri
2424
2525class PropertiesSpec : StringSpec ({
2626 @Suppress(" UNUSED_PARAMETER" )
@@ -34,7 +34,7 @@ class PropertiesSpec: StringSpec({
3434 }
3535
3636 " get raw value" {
37- val bucket = createBucket(empty(), linkedMapOf<String , Any >("foo" to "bar"))
37+ val bucket = createBucket(Scope . empty(), linkedMapOf<String , Any >("foo" to "bar"))
3838 Properties (mockk(), bucket).getRawValue("foo").shouldBe("bar")
3939 }
4040
@@ -46,18 +46,18 @@ class PropertiesSpec: StringSpec({
4646 }
4747
4848 " gets object" {
49- val bucket = createBucket(empty(), linkedMapOf<String , Any >("foo" to mapOf<String , Any >()))
49+ val bucket = createBucket(Scope . empty(), linkedMapOf<String , Any >("foo" to mapOf<String , Any >()))
5050
51- val scope = Scope . createScope(URI .create ("https://foo"), bucket.rawValues, anyVersion)
51+ val scope = createScope(createUri ("https://foo"), bucket.rawValues, anyVersion)
5252 val props = Properties (Context (scope, mockk()), bucket)
5353
5454 props.getObjectOrNull("foo", DummyObject ::class.java).shouldBeInstanceOf<DummyObject >()
5555 }
5656
5757 " gets object throws if value is not an object" {
58- val bucket = createBucket(empty(), linkedMapOf<String , Any >("foo" to "no object"))!!
58+ val bucket = createBucket(Scope . empty(), linkedMapOf<String , Any >("foo" to "no object"))
5959
60- val scope = Scope . createScope(URI .create ("https://foo"), bucket.rawValues, anyVersion)
60+ val scope = createScope(createUri ("https://foo"), bucket.rawValues, anyVersion)
6161 val props = Properties (Context (scope, mockk()), bucket)
6262
6363 shouldThrow<TypeMismatchException > {
@@ -82,7 +82,8 @@ class PropertiesSpec: StringSpec({
8282 }
8383
8484 " get objects array" {
85- val bucket = Bucket (
85+ val bucket = createBucket(
86+ Scope .empty(),
8687 linkedMapOf<String , Any >(
8788 "property" to listOf(
8889 mapOf<String , Any >("foo" to "bar"),
@@ -91,14 +92,15 @@ class PropertiesSpec: StringSpec({
9192 )
9293 )
9394
94- val scope = Scope . createScope(URI .create ("https://foo"), bucket.rawValues, anyVersion)
95+ val scope = createScope(createUri ("https://foo"), bucket.rawValues, anyVersion)
9596 val props = Properties (Context (scope, mockk()), bucket)
9697
9798 props.getObjectsOrEmpty("property", DummyObject ::class.java).size shouldBe 2
9899 }
99100
100101 " get objects array throws if any value is not an object" {
101- val bucket = Bucket (
102+ val bucket = createBucket(
103+ Scope .empty(),
102104 linkedMapOf<String , Any >(
103105 "property" to listOf(
104106 mapOf<String , Any >("foo" to "bar"),
@@ -107,7 +109,7 @@ class PropertiesSpec: StringSpec({
107109 )
108110 )
109111
110- val scope = Scope . createScope(URI .create ("https://foo"), bucket.rawValues, anyVersion)
112+ val scope = createScope(createUri ("https://foo"), bucket.rawValues, anyVersion)
111113 val props = Properties (Context (scope, mockk()), bucket)
112114
113115 shouldThrow<TypeMismatchException > {
@@ -116,7 +118,8 @@ class PropertiesSpec: StringSpec({
116118 }
117119
118120 " get extension values" {
119- val bucket = Bucket (
121+ val bucket = createBucket(
122+ Scope .empty(),
120123 linkedMapOf<String , Any >(
121124 "property" to "foo",
122125 "x-foo" to "foo extension",
@@ -131,7 +134,8 @@ class PropertiesSpec: StringSpec({
131134 }
132135
133136 " gets empty extension values if there are no extensions" {
134- val bucket = Bucket (
137+ val bucket = createBucket(
138+ Scope .empty(),
135139 linkedMapOf<String , Any >(
136140 "property" to "foo",
137141 )
0 commit comments