use of org.talend.daikon.exception.json.JsonErrorCode in project data-prep by Talend.
the class DataSetAPITest method testDataSetCreateUnsupportedFormat.
@Test
public void testDataSetCreateUnsupportedFormat() throws Exception {
// given
final String datasetContent = IOUtils.toString(DataSetAPITest.class.getResourceAsStream("dataset/dataset.pdf"), UTF_8);
final int metadataCount = dataSetMetadataRepository.size();
// then
final Response response = given().body(datasetContent).when().post("/api/datasets");
assertThat(response.getStatusCode(), is(400));
JsonErrorCode code = mapper.readValue(response.asString(), JsonErrorCode.class);
assertThat(code.getCode(), is(DataSetErrorCodes.UNSUPPORTED_CONTENT.getCode()));
// No data set metadata should be created
assertThat(dataSetMetadataRepository.size(), is(metadataCount));
}
Aggregations