use of com.hubspot.rosetta.beans.StoredAsJsonListTypeInfoBean.ConcreteStoredAsJsonList in project Rosetta by HubSpot.
the class StoredAsJsonTest method itHandlesSubTypes.
@Test
public void itHandlesSubTypes() throws JsonProcessingException {
ConcreteStoredAsJsonList typeInfoBean = new ConcreteStoredAsJsonList();
typeInfoBean.setInnerBeans(Collections.singletonList(inner));
TextNode expectedList = TextNode.valueOf("[{\"stringProperty\":\"value\"}]");
JsonNode node = Rosetta.getMapper().valueToTree(typeInfoBean);
assertThat(node.get("innerBeans")).isEqualTo(expectedList);
assertThat(Rosetta.getMapper().treeToValue(node, StoredAsJsonListTypeInfoBean.class).getInnerBeans().get(0).getStringProperty()).isEqualTo("value");
assertThat(Rosetta.getMapper().treeToValue(node, ConcreteStoredAsJsonList.class).getInnerBeans().get(0).getStringProperty()).isEqualTo("value");
}
Aggregations