java.lang.ClassCastException: java.util.LinkedHashMap 不能 cast to com.testing.models.Account
2022-08-31 09:59:55
我得到以下错误:
java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to com.testing.models.Account
使用以下代码
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);
我没有理由不能这样做?get(0)