use of com.hubspot.rosetta.beans.PolymorphicBeanA in project Rosetta by HubSpot.
the class StoredAsJsonTest method testSerializingOptionalStoredAsJsonBean.
@Test
public void testSerializingOptionalStoredAsJsonBean() {
OptionalStoredAsJsonBean bean = new OptionalStoredAsJsonBean(java.util.Optional.of(new PolymorphicBeanA()));
JsonNode node = Rosetta.getMapper().valueToTree(bean);
assertThat(node.get("bean")).isNotNull();
assertThat(node.get("bean").textValue()).contains("beanType");
}
use of com.hubspot.rosetta.beans.PolymorphicBeanA in project Rosetta by HubSpot.
the class StoredAsJsonTest method testPolymorphicStoredAsJsonBeans.
@Test
public void testPolymorphicStoredAsJsonBeans() throws JsonProcessingException {
PolymorphicStoredAsJsonBean bean = new PolymorphicStoredAsJsonBean();
bean.setAnnotatedField(new PolymorphicBeanA());
JsonNode node = Rosetta.getMapper().valueToTree(bean);
assertThat(node.get("annotatedField")).isNotNull();
assertThat(node.get("annotatedField").hasNonNull("beanType"));
assertThat(Rosetta.getMapper().treeToValue(node, PolymorphicStoredAsJsonBean.class).getAnnotatedField()).isInstanceOf(PolymorphicBeanA.class);
}
use of com.hubspot.rosetta.beans.PolymorphicBeanA in project Rosetta by HubSpot.
the class StoredAsJsonTest method testSerializingMapStoredAsJsonBean.
@Test
public void testSerializingMapStoredAsJsonBean() {
MapStoredAsJsonBean bean = new MapStoredAsJsonBean(ImmutableMap.of("A", new PolymorphicBeanA()));
JsonNode node = Rosetta.getMapper().valueToTree(bean);
assertThat(node.get("beans")).isNotNull();
assertThat(node.get("beans").textValue()).contains("beanType");
}
use of com.hubspot.rosetta.beans.PolymorphicBeanA in project Rosetta by HubSpot.
the class StoredAsJsonTest method testSerializingListStoredAsJsonBean.
@Test
public void testSerializingListStoredAsJsonBean() {
ListStoredAsJsonBean bean = new ListStoredAsJsonBean(Arrays.asList(new PolymorphicBeanA()));
JsonNode node = Rosetta.getMapper().valueToTree(bean);
assertThat(node.get("beans")).isNotNull();
assertThat(node.get("beans").textValue()).contains("beanType");
}
use of com.hubspot.rosetta.beans.PolymorphicBeanA in project Rosetta by HubSpot.
the class StoredAsJsonTest method testSerializingSetStoredAsJsonBean.
@Test
public void testSerializingSetStoredAsJsonBean() {
SetStoredAsJsonBean bean = new SetStoredAsJsonBean(ImmutableSet.of(new PolymorphicBeanA()));
JsonNode node = Rosetta.getMapper().valueToTree(bean);
assertThat(node.get("beans")).isNotNull();
assertThat(node.get("beans").textValue()).contains("beanType");
}
Aggregations