@When("^the service is called$")
public void service() throws Throwable {
Response response = serviceCaller.get(serviceUrl + nameId);
GroupInfoModel groupInfoModel = response.readEntity(GorupInfoModel.class);
}
@Then("^I should see$")
public void i_should_see(List<String> nameList) throws Throwable {
NameHeaderModel person = GroupInfoModel.getPerson();
Field[] declaredFields = person.getClass().getDeclaredFields();
for (Field fieldList : declaredFields) {
assertTrue(nameList.contains(fieldList.getName()));
}
}
So I have a wrappers class GroupInfoModel which gets persons. NameHeaderModel is model class with entities in it. I wanted to know if there is a better way to access fields in person class after the response and compare it. Im writing a simple rest service to send json object and then consuming it from this reponse.
So my question what is a better way to access fields because reflections can be an expensive operation?
Aucun commentaire:
Enregistrer un commentaire