use of com.fasterxml.jackson.databind.node.ObjectNode in project Rosetta by HubSpot.
the class StoredAsJsonTest method testAnnotatedSetterNullDeserialization.
@Test
public void testAnnotatedSetterNullDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("annotatedSetter", NullNode.getInstance());
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getAnnotatedSetter()).isNull();
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project Rosetta by HubSpot.
the class StoredAsJsonTest method testJsonNodeNullDeserialization.
@Test
public void testJsonNodeNullDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("jsonNodeField", NullNode.getInstance());
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getJsonNodeField()).isEqualTo(NullNode.getInstance());
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project Rosetta by HubSpot.
the class StoredAsJsonTest method testBinaryFieldWithDefaultNullDeserialization.
@Test
public void testBinaryFieldWithDefaultNullDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("binaryFieldWithDefault", NullNode.getInstance());
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getBinaryFieldWithDefault().getStringProperty()).isEqualTo("value");
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project Rosetta by HubSpot.
the class StoredAsJsonTest method testAnnotatedFieldDeserialization.
@Test
public void testAnnotatedFieldDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("annotatedField", expected);
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getAnnotatedField().getStringProperty()).isEqualTo("value");
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project Rosetta by HubSpot.
the class StoredAsJsonTest method testAnnotatedGetterWithDefaultDeserialization.
@Test
public void testAnnotatedGetterWithDefaultDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("annotatedGetterWithDefault", expected);
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getAnnotatedGetterWithDefault().getStringProperty()).isEqualTo("value");
}
Aggregations