use of com.auth0.json.mgmt.jobs.JobErrorDetails in project auth0-java by auth0.
the class JobsEntityTest method shouldGetJobErrorDetails_noErrors.
@Test
public void shouldGetJobErrorDetails_noErrors() throws Exception {
Request<List<JobErrorDetails>> request = api.jobs().getErrorDetails("1");
assertThat(request, is(notNullValue()));
server.noContentResponse();
List<JobErrorDetails> response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/jobs/1/errors"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(response, is(notNullValue()));
assertThat(response, is(empty()));
}
use of com.auth0.json.mgmt.jobs.JobErrorDetails in project auth0-java by auth0.
the class JobsEntityTest method shouldGetJobErrorDetails.
@Test
public void shouldGetJobErrorDetails() throws Exception {
Request<List<JobErrorDetails>> request = api.jobs().getErrorDetails("1");
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_JOB_ERROR_DETAILS, 200);
List<JobErrorDetails> response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/jobs/1/errors"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(response, is(notNullValue()));
assertThat(response, hasSize(1));
assertThat(response.get(0).getErrors(), hasSize(1));
}
use of com.auth0.json.mgmt.jobs.JobErrorDetails in project auth0-java by auth0.
the class JobErrorDetailsTest method shouldSerialize.
@Test
public void shouldSerialize() throws JsonProcessingException {
User user = new User();
user.setEmail("john.doe@gmail.com");
JobError error = new JobError("code", "message", "path");
JobErrorDetails errorDetails = new JobErrorDetails(user, Collections.singletonList(error));
String serialized = toJSON(errorDetails);
assertThat(serialized, is(equalTo(json)));
}
Aggregations