lundi 2 mars 2015

java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to com.testing.models.Account



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;

Club newClub = create();

int expectedResponseCode = Response.SC_OK;

ArrayList<Account> account = given().when().expect().statusCode(expectedResponseCode)
.get("accounts/" + newClub.getOwner().getCustId() + "/clubs")
.as(ArrayList.class);
assertThat(account.get(0).getId()).isEqualTo(expectedId);


Is there a reason why I cannot do get(0)?


When I do .size() it shows the entry and output is there.




Aucun commentaire:

Enregistrer un commentaire