use of com.epam.ta.reportportal.ws.model.ErrorRS in project service-api by reportportal.
the class TestItemControllerValidationTest method startRootTestItemShouldReturnErrorWhenNameIsNull.
@Test
public void startRootTestItemShouldReturnErrorWhenNameIsNull() throws Exception {
// GIVEN
StartTestItemRQ startTestItemRQ = prepareTestItem();
// WHEN
MvcResult mvcResult = mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + ITEM_PATH).with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(startTestItemRQ)).contentType(APPLICATION_JSON)).andExpect(status().isBadRequest()).andReturn();
// THEN
ErrorRS error = objectMapper.readValue(mvcResult.getResponse().getContentAsString(), ErrorRS.class);
assertEquals(INCORRECT_REQUEST, error.getErrorType());
assertEquals(INCORRECT_REQUEST_MESSAGE + FIELD_NAME_IS_NULL_MESSAGE, error.getMessage());
}
use of com.epam.ta.reportportal.ws.model.ErrorRS in project service-api by reportportal.
the class TestItemControllerValidationTest method startChildTestItemShouldReturnErrorWhenNameIsNull.
@Test
public void startChildTestItemShouldReturnErrorWhenNameIsNull() throws Exception {
// GIVEN
StartTestItemRQ startTestItemRQ = prepareTestItem();
// WHEN
MvcResult mvcResult = mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + ITEM_PATH + PARENT_ID_PATH).with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(startTestItemRQ)).contentType(APPLICATION_JSON)).andExpect(status().isBadRequest()).andReturn();
// THEN
ErrorRS error = objectMapper.readValue(mvcResult.getResponse().getContentAsString(), ErrorRS.class);
assertEquals(INCORRECT_REQUEST, error.getErrorType());
assertEquals(INCORRECT_REQUEST_MESSAGE + FIELD_NAME_IS_NULL_MESSAGE, error.getMessage());
}
use of com.epam.ta.reportportal.ws.model.ErrorRS in project service-api by reportportal.
the class UserFilterControllerValidationTest method createFilterShouldReturnErrorWhenNameIsEmpty.
@Test
public void createFilterShouldReturnErrorWhenNameIsEmpty() throws Exception {
// GIVEN
UpdateUserFilterRQ userFilterRQ = prepareFilter();
userFilterRQ.setName(EMPTY);
// WHEN
MvcResult mvcResult = mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + FILTER_PATH).with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(userFilterRQ)).contentType(APPLICATION_JSON)).andExpect(status().isBadRequest()).andReturn();
// THEN
ErrorRS error = objectMapper.readValue(mvcResult.getResponse().getContentAsString(), ErrorRS.class);
assertEquals(INCORRECT_REQUEST, error.getErrorType());
assertEquals(INCORRECT_REQUEST_MESSAGE + "[" + FIELD_NAME_IS_BLANK_MESSAGE + " " + FIELD_NAME_SIZE_MESSAGE + "] ", error.getMessage());
}
use of com.epam.ta.reportportal.ws.model.ErrorRS in project service-api by reportportal.
the class UserFilterControllerValidationTest method createFilterShouldReturnErrorWhenNameIsNull.
@Test
public void createFilterShouldReturnErrorWhenNameIsNull() throws Exception {
// GIVEN
UpdateUserFilterRQ userFilterRQ = prepareFilter();
// WHEN
MvcResult mvcResult = mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + FILTER_PATH).with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(userFilterRQ)).contentType(APPLICATION_JSON)).andExpect(status().isBadRequest()).andReturn();
// THEN
ErrorRS error = objectMapper.readValue(mvcResult.getResponse().getContentAsString(), ErrorRS.class);
assertEquals(INCORRECT_REQUEST, error.getErrorType());
assertEquals(INCORRECT_REQUEST_MESSAGE + FIELD_NAME_IS_NULL_MESSAGE, error.getMessage());
}
use of com.epam.ta.reportportal.ws.model.ErrorRS in project service-api by reportportal.
the class UserFilterControllerValidationTest method createFilterShouldReturnErrorWhenNameIsLessThanThreeCharacters.
@Test
public void createFilterShouldReturnErrorWhenNameIsLessThanThreeCharacters() throws Exception {
// GIVEN
UpdateUserFilterRQ userFilterRQ = prepareFilter();
userFilterRQ.setName(SHORT_NAME_VALUE);
// WHEN
MvcResult mvcResult = mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + FILTER_PATH).with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(userFilterRQ)).contentType(APPLICATION_JSON)).andExpect(status().isBadRequest()).andReturn();
// THEN
ErrorRS error = objectMapper.readValue(mvcResult.getResponse().getContentAsString(), ErrorRS.class);
assertEquals(INCORRECT_REQUEST, error.getErrorType());
assertEquals(INCORRECT_REQUEST_MESSAGE + "[" + FIELD_NAME_SIZE_MESSAGE + "] ", error.getMessage());
}
Aggregations