use of io.irontest.core.teststep.APIResponse in project irontest by zheng-wang.
the class TeststepRunMapper method map.
public TeststepRun map(ResultSet rs, StatementContext ctx) throws SQLException {
TeststepRun teststepRun = new TeststepRun();
ObjectMapper objectMapper = new ObjectMapper();
teststepRun.setId(rs.getLong("id"));
teststepRun.setStartTime(rs.getTimestamp("starttime"));
teststepRun.setDuration(rs.getLong("duration"));
teststepRun.setResult(TestResult.getByText(rs.getString("result")));
Teststep teststep;
try {
teststep = objectMapper.readValue(rs.getString("teststep"), Teststep.class);
} catch (IOException e) {
throw new SQLException("Failed to deserialize teststep JSON.", e);
}
teststepRun.setTeststep(teststep);
APIResponse response;
try {
response = objectMapper.readValue(rs.getString("response"), APIResponse.class);
} catch (IOException e) {
throw new SQLException("Failed to deserialize response JSON.", e);
}
teststepRun.setResponse(response);
teststepRun.setInfoMessage(rs.getString("info_message"));
teststepRun.setErrorMessage(rs.getString("error_message"));
List<AssertionVerification> assertionVerifications;
try {
assertionVerifications = new ObjectMapper().readValue(rs.getString("assertion_verifications"), new TypeReference<List<AssertionVerification>>() {
});
} catch (IOException e) {
throw new SQLException("Failed to deserialize stepruns JSON.", e);
}
teststepRun.setAssertionVerifications(assertionVerifications);
return teststepRun;
}
Aggregations