Set deprecated field as unwrapped

This commit is contained in:
inalarsanukaev 2020-01-21 17:44:50 +03:00
parent 6c6de48d53
commit e85fd17343
2 changed files with 27 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package com.rbkmoney.adapter.common.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.rbkmoney.adapter.common.enums.Step;
import lombok.Data;
@ -21,6 +22,7 @@ public class AdapterContext {
private Step step;
@JsonUnwrapped
private PollingInfo pollingInfo;
}

View File

@ -0,0 +1,25 @@
package com.rbkmoney.adapter.common.model;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
import java.time.Instant;
import static org.junit.Assert.*;
public class AdapterContextTest {
@Test
public void testUnwrapped() throws JsonProcessingException {
ObjectMapper om = new ObjectMapper();
AdapterContext ac = new AdapterContext();
ac.setMd("kek");
PollingInfo pollingInfo = new PollingInfo();
pollingInfo.setMaxDateTimePolling(Instant.now());
ac.setPollingInfo(pollingInfo);
String str = om.writeValueAsString(ac);
assertTrue(str.startsWith("{\"md\":\"kek\",\"max_date_time_polling\":"));
}
}