Search in sources :

Example 1 with PolymorphicBeanASubTypeA

use of com.hubspot.rosetta.beans.PolymorphicBeanASubTypeA in project Rosetta by HubSpot.

the class StoredAsJsonTest method testSerializingOptionalStoredAsJsonSubtypeBean.

@Test
public void testSerializingOptionalStoredAsJsonSubtypeBean() {
    OptionalStoredAsJsonBean bean = new OptionalStoredAsJsonBean(java.util.Optional.of(new PolymorphicBeanASubTypeA()));
    JsonNode node = Rosetta.getMapper().valueToTree(bean);
    assertThat(node.get("bean")).isNotNull();
    assertThat(node.get("bean").textValue()).contains("beanType");
}
Also used : OptionalStoredAsJsonBean(com.hubspot.rosetta.beans.OptionalStoredAsJsonBeanIF.OptionalStoredAsJsonBean) JsonNode(com.fasterxml.jackson.databind.JsonNode) PolymorphicBeanASubTypeA(com.hubspot.rosetta.beans.PolymorphicBeanASubTypeA) Test(org.junit.Test)

Aggregations

JsonNode (com.fasterxml.jackson.databind.JsonNode)1 OptionalStoredAsJsonBean (com.hubspot.rosetta.beans.OptionalStoredAsJsonBeanIF.OptionalStoredAsJsonBean)1 PolymorphicBeanASubTypeA (com.hubspot.rosetta.beans.PolymorphicBeanASubTypeA)1 Test (org.junit.Test)1