Guys, I'm learning to work with setter and getter, but I got a Json that was too complex for me.
can you help me?
It's a request that I need to send, the Json is the one below.
{
"properties": {
"headers": {
"eventLayout": "qa",
"eventReferenceDate": "2021-09-22"
}
},
"routing_key": "tvm.teste.teste.UPDATED",
"payload": "string",
"payload_encoding": "string"
}
it has two objects, but whenever I go to create and run the test, I receive bad-Request because I didn't provide the complete json, following the structure below.
{
"properties": {
"headers": {etc...}
Here's how I implemented my code.
package com.automation.models;
import com.fasterxml.jackson.annotation.JsonProperty;
public class PostRequestPojo {
public static class Properties {
private Headers headers;
public Properties() {
}
public Properties(Headers headers) {
this.headers = headers;
}
public Headers getHeaders() {
return headers;
}
public void setHeaders(Headers headers) {
this.headers = headers;
}
}
@JsonProperty("eventLayout")
public String eventLayout;
public String getEventLayout() {
return eventLayout;
}
public void setEventLayout(String eventLayout) {
this.eventLayout = eventLayout;
}
@JsonProperty("eventReferenceDate")
public String eventReferenceDate;
public String getEventReferenceDate() {
return eventReferenceDate;
}
public void setEventReferenceDate(String eventReferenceDate) {
this.eventReferenceDate = eventReferenceDate;
}
@JsonProperty("routing_key")
public String routing_key;
public String getRouting_key() {
return routing_key;
}
public void setRouting_key(String routing_key) {
this.routing_key = routing_key;
}
@JsonProperty("payload")
public String payload;
public String getPayload() {
return payload;
}
public void setPayload(String payload) {
this.payload = payload;
}
@JsonProperty("payload_encoding")
public String payload_encoding;
public String payload_encoding() {
return payload_encoding;
}
public void payload_encoding(String payload_encoding) {
this.payload_encoding = payload_encoding;
}
public PostRequestPojo() {
"properties":{
"headers":{
eventLayout = "qa",
eventReferenceDate = "2021-09-22";
}
} ;
routing_key = "UPDATED";
payload = "string";
payload_encoding = "string";
}
}