use of com.hubspot.rosetta.beans.StoredAsJsonBean in project Rosetta by HubSpot.
the class StoredAsJsonTest method testAnnotatedGetterNullDeserialization.
@Test
public void testAnnotatedGetterNullDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("annotatedGetter", NullNode.getInstance());
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getAnnotatedGetter()).isNull();
}
use of com.hubspot.rosetta.beans.StoredAsJsonBean in project Rosetta by HubSpot.
the class StoredAsJsonTest method testBinaryFieldNullDeserialization.
@Test
public void testBinaryFieldNullDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("binaryField", NullNode.getInstance());
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getBinaryField()).isNull();
}
use of com.hubspot.rosetta.beans.StoredAsJsonBean in project Rosetta by HubSpot.
the class StoredAsJsonTest method testOptionalGetterNullDeserialization.
@Test
public void testOptionalGetterNullDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("optionalGetter", NullNode.getInstance());
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getOptionalGetter()).isNotNull();
assertThat(bean.getOptionalGetter().isPresent()).isFalse();
}
use of com.hubspot.rosetta.beans.StoredAsJsonBean in project Rosetta by HubSpot.
the class StoredAsJsonTest method testOptionalFieldNullDeserialization.
@Test
public void testOptionalFieldNullDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("optionalField", NullNode.getInstance());
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getOptionalField()).isNotNull();
assertThat(bean.getOptionalField().isPresent()).isFalse();
}
use of com.hubspot.rosetta.beans.StoredAsJsonBean in project Rosetta by HubSpot.
the class StoredAsJsonTest method testAnnotatedGetterDeserialization.
@Test
public void testAnnotatedGetterDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("annotatedGetter", expected);
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getAnnotatedGetter().getStringProperty()).isEqualTo("value");
}
Aggregations