Search in sources :

Example 1 with NullPolymorphicBean

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

the class StoredAsJsonTest method testNullPolymorphicStoredAsJsonBean.

@Test
public void testNullPolymorphicStoredAsJsonBean() {
    PolymorphicStoredAsJsonBean bean = new PolymorphicStoredAsJsonBean();
    bean.setAnnotatedField(new NullPolymorphicBean());
    JsonNode node = Rosetta.getMapper().valueToTree(bean);
    assertThat(node.get("annotatedField")).isNotNull();
    assertThat(node.get("annotatedField").isNull()).isTrue();
}
Also used : NullPolymorphicBean(com.hubspot.rosetta.beans.NullPolymorphicBean) PolymorphicStoredAsJsonBean(com.hubspot.rosetta.beans.PolymorphicStoredAsJsonBean) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test)

Aggregations

JsonNode (com.fasterxml.jackson.databind.JsonNode)1 NullPolymorphicBean (com.hubspot.rosetta.beans.NullPolymorphicBean)1 PolymorphicStoredAsJsonBean (com.hubspot.rosetta.beans.PolymorphicStoredAsJsonBean)1 Test (org.junit.Test)1