use of com.hubspot.rosetta.beans.StoredAsJsonBean in project Rosetta by HubSpot.
the class StoredAsJsonTest method testOptionalGetterDeserialization.
@Test
public void testOptionalGetterDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("optionalGetter", expected);
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getOptionalGetter().isPresent()).isTrue();
assertThat(bean.getOptionalGetter().get().getStringProperty()).isEqualTo("value");
}
use of com.hubspot.rosetta.beans.StoredAsJsonBean in project Rosetta by HubSpot.
the class StoredAsJsonTest method testOptionalSetterDeserialization.
@Test
public void testOptionalSetterDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("optionalSetter", expected);
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getOptionalSetter().isPresent()).isTrue();
assertThat(bean.getOptionalSetter().get().getStringProperty()).isEqualTo("value");
}
use of com.hubspot.rosetta.beans.StoredAsJsonBean in project Rosetta by HubSpot.
the class StoredAsJsonTest method testOptionalFieldDeserialization.
@Test
public void testOptionalFieldDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("optionalField", expected);
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getOptionalField().isPresent()).isTrue();
assertThat(bean.getOptionalField().get().getStringProperty()).isEqualTo("value");
}
use of com.hubspot.rosetta.beans.StoredAsJsonBean in project Rosetta by HubSpot.
the class StoredAsJsonTest method testBinaryFieldDeserialization.
@Test
public void testBinaryFieldDeserialization() throws JsonProcessingException {
ObjectNode node = Rosetta.getMapper().createObjectNode();
node.put("binaryField", expectedBinary);
StoredAsJsonBean bean = Rosetta.getMapper().treeToValue(node, StoredAsJsonBean.class);
assertThat(bean.getBinaryField().getStringProperty()).isEqualTo("value");
}
Aggregations