use of com.epam.ta.reportportal.ws.model.ErrorRS in project service-api by reportportal.
the class UserFilterControllerValidationTest method updateFilterShouldReturnErrorWhenNameIsNull.
@Test
public void updateFilterShouldReturnErrorWhenNameIsNull() throws Exception {
// GIVEN
UpdateUserFilterRQ userFilterRQ = prepareFilter();
// WHEN
MvcResult mvcResult = mockMvc.perform(put(DEFAULT_PROJECT_BASE_URL + FILTER_PATH + ID_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 LaunchControllerValidationTest method createLaunchShouldReturnErrorWhenNameIsNull.
@Test
public void createLaunchShouldReturnErrorWhenNameIsNull() throws Exception {
// GIVEN
StartLaunchRQ startLaunchRQ = prepareLaunch();
// WHEN
MvcResult mvcResult = mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + LAUNCH_PATH).with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(startLaunchRQ)).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 LaunchControllerValidationTest method createLaunchShouldReturnErrorWhenNameIsEmpty.
@Test
public void createLaunchShouldReturnErrorWhenNameIsEmpty() throws Exception {
// GIVEN
StartLaunchRQ startLaunchRQ = prepareLaunch();
startLaunchRQ.setName(EMPTY);
// WHEN
MvcResult mvcResult = mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + LAUNCH_PATH).with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(startLaunchRQ)).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 LaunchControllerValidationTest method mergeLaunchShouldReturnErrorWhenNameIsEmpty.
@Test
public void mergeLaunchShouldReturnErrorWhenNameIsEmpty() throws Exception {
// GIVEN
MergeLaunchesRQ mergeLaunchesRQ = prepareLaunchesMerge();
mergeLaunchesRQ.setName(EMPTY);
// WHEN
MvcResult mvcResult = mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + LAUNCH_PATH + MERGE_PATH).with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(mergeLaunchesRQ)).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 LaunchControllerValidationTest method mergeLaunchShouldReturnErrorWhenNameIsGreaterThanTwoHundredAndFiftySixCharacters.
@Test
public void mergeLaunchShouldReturnErrorWhenNameIsGreaterThanTwoHundredAndFiftySixCharacters() throws Exception {
// GIVEN
MergeLaunchesRQ mergeLaunchesRQ = prepareLaunchesMerge();
mergeLaunchesRQ.setName(LONG_NAME_VALUE);
// WHEN
MvcResult mvcResult = mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + LAUNCH_PATH + MERGE_PATH).with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(mergeLaunchesRQ)).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