Skip to content

Commit 71cc3e5

Browse files
committed
[Bug #84] Ensure typed literals are correctly deserialized into string-based unmapped properties.
1 parent 8e7720b commit 71cc3e5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/test/java/cz/cvut/kbss/jsonld/deserialization/expanded/ExpandedJsonLdDeserializerTest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,4 +917,25 @@ void deserializationHandlesTypedLiteralsForTypedProperties() throws Exception {
917917
assertEquals(Set.of(true), result.getProperties().get(URI.create(
918918
"http://onto.fel.cvut.cz/ontologies/application/jb4jsonld/attribute/approved")));
919919
}
920+
921+
@Test
922+
void deserializationHandlesTypedLiteralsForUntypedProperties() throws Exception {
923+
final JsonArray input = readAndExpand("objectWithTypedLiteralInProperties.json");
924+
final Person result = sut.deserialize(input, Person.class);
925+
assertNotNull(result);
926+
assertEquals("Catherine", result.getFirstName());
927+
assertEquals("Halsey", result.getLastName());
928+
assertThat(result.getProperties(),
929+
hasKey("http://onto.fel.cvut.cz/ontologies/application/jb4jsonld/attribute/warrantor"));
930+
assertEquals(Set.of("Lord Hood"), result.getProperties()
931+
.get("http://onto.fel.cvut.cz/ontologies/application/jb4jsonld/attribute/warrantor"));
932+
assertThat(result.getProperties(),
933+
hasKey("http://onto.fel.cvut.cz/ontologies/application/jb4jsonld/attribute/revision-count"));
934+
assertEquals(Set.of("4", "8"), result.getProperties()
935+
.get("http://onto.fel.cvut.cz/ontologies/application/jb4jsonld/attribute/revision-count"));
936+
assertThat(result.getProperties(),
937+
hasKey("http://onto.fel.cvut.cz/ontologies/application/jb4jsonld/attribute/approved"));
938+
assertEquals(Set.of("true"), result.getProperties()
939+
.get("http://onto.fel.cvut.cz/ontologies/application/jb4jsonld/attribute/approved"));
940+
}
920941
}

0 commit comments

Comments
 (0)