0
Hello, I’m training with Rest Assured
, I can’t show the project itself, but basically, it’s past token
and some parameters per header, and the API returns various data, it would be something like :
{
"data": {
"data_nascimento" : "exemplo",
"nome_completo" : "exemplo",
"numero_cpf" : "exemplo",
"vivo" : true
}
}
The class I created as follows:
public Class Data {
private String data_nascimento;
private String nome_completo;
private String numero_cpf;
private boolean vivo;
//Getter e Setter
}
And in the call I’m trying in two different ways, but both return null value
Data dados = given()
.header(//map com header e token)
when.
.get("/cliente").as(Data.class);
That was one of the ways the other was to use extract().body().as(Data.class)
, but the data are not being deserialized.
I managed to solve, I created a separate class and called this class.
– brunovale