use of io.crnk.core.engine.document.ErrorDataBuilder in project crnk-framework by crnk-project.
the class ClientDocumentMapperTest method testCannotHaveErrors.
@Test(expected = IllegalStateException.class)
public void testCannotHaveErrors() throws IOException {
Document doc = new Document();
doc.setErrors(Arrays.asList(new ErrorDataBuilder().build()));
doc.setData(Nullable.nullValue());
documentMapper.fromDocument(doc, false);
}
use of io.crnk.core.engine.document.ErrorDataBuilder in project crnk-framework by crnk-project.
the class BraveResponseFilterTest method statusCodeNotOkWhenEmptyErrors.
@Test
public void statusCodeNotOkWhenEmptyErrors() {
ErrorData errorData = new ErrorDataBuilder().setId("test").build();
JsonApiResponse response = new JsonApiResponse();
response.setErrors(Arrays.asList(errorData));
Mockito.when(filterChain.doFilter(Mockito.any(RepositoryFilterContext.class))).thenReturn(response);
filter.filterRequest(filterContext, filterChain);
Mockito.verify(span, Mockito.times(1)).tag(BraveRepositoryFilter.STATUS_CODE_ANNOTATION, BraveRepositoryFilter.STRING_EXCEPTION);
}
Aggregations