I'm getting below error:
java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to com.testing.models.Account
with below code
final int expectedId = 1;
Test newTest = create();
int expectedResponseCode = Response.SC_OK;
ArrayList<Account> account = given().when().expect().statusCode(expectedResponseCode)
.get("accounts/" + newTest.id() + "/users")
.as(ArrayList.class);
assertThat(account.get(0).getId()).isEqualTo(expectedId);
Is there a reason why I cannot do get(0)
?
Account
? Why are you trying to cast to it from a map? – Dave Newton Mar 3 at 0:06given()
method is statically imported from? – Mark Peters Mar 3 at 0:07Account
is a model from Dropwizard which usescom.fasterxml.jackson.databind.annotations
– Passionate Developer Mar 3 at 0:08