use of com.hubspot.rosetta.beans.StoredAsJsonBean in project Rosetta by HubSpot.
the class StoredAsJsonTest method testOptionalSetterNullDeserialization.
@Test
public void testOptionalSetterNullDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("optionalSetter", NullNode.getInstance());
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getOptionalSetter()).isNotNull();
assertThat(bean.getOptionalSetter().isPresent()).isFalse();
}
use of com.hubspot.rosetta.beans.StoredAsJsonBean in project Rosetta by HubSpot.
the class StoredAsJsonTest method testBinaryFieldWithDefaultDeserialization.
@Test
public void testBinaryFieldWithDefaultDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("binaryFieldWithDefault", expectedBinary);
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getBinaryFieldWithDefault().getStringProperty()).isEqualTo("value");
}
use of com.hubspot.rosetta.beans.StoredAsJsonBean in project Rosetta by HubSpot.
the class StoredAsJsonTest method testAnnotatedSetterDeserialization.
@Test
public void testAnnotatedSetterDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("annotatedSetter", expected);
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getAnnotatedSetter().getStringProperty()).isEqualTo("value");
}
use of com.hubspot.rosetta.beans.StoredAsJsonBean in project Rosetta by HubSpot.
the class StoredAsJsonTest method testAnnotatedFieldNullDeserialization.
@Test
public void testAnnotatedFieldNullDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("annotatedField", NullNode.getInstance());
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getAnnotatedField()).isNull();
}
use of com.hubspot.rosetta.beans.StoredAsJsonBean in project Rosetta by HubSpot.
the class StoredAsJsonTest method testAnnotatedGetterWithDefaultNullDeserialization.
@Test
public void testAnnotatedGetterWithDefaultNullDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("annotatedGetterWithDefault", NullNode.getInstance());
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getAnnotatedGetterWithDefault().getStringProperty()).isEqualTo("value");
}
Aggregations