use of com.epam.ta.reportportal.ws.model.ErrorRS in project service-api by reportportal.
the class LaunchControllerValidationTest method createLaunchShouldReturnErrorWhenNameIsGreaterThanTwoHundredAndFiftySixCharacters.
@Test
public void createLaunchShouldReturnErrorWhenNameIsGreaterThanTwoHundredAndFiftySixCharacters() throws Exception {
// GIVEN
StartLaunchRQ startLaunchRQ = prepareLaunch();
startLaunchRQ.setName(LONG_NAME_VALUE);
// 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_SIZE_MESSAGE + "] ", error.getMessage());
}
use of com.epam.ta.reportportal.ws.model.ErrorRS in project service-api by reportportal.
the class LaunchControllerValidationTest method mergeLaunchShouldReturnErrorWhenNameConsistsOfWhitespaces.
@Test
public void mergeLaunchShouldReturnErrorWhenNameConsistsOfWhitespaces() throws Exception {
// GIVEN
MergeLaunchesRQ mergeLaunchesRQ = prepareLaunchesMerge();
mergeLaunchesRQ.setName(WHITESPACES_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_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 BugTrackingSystemControllerTest method shouldNotCreateIssueWhenMoreThen300BackLinks.
@Test
void shouldNotCreateIssueWhenMoreThen300BackLinks() throws Exception {
final PostTicketRQ request = new PostTicketRQ();
final Map<Long, String> backLinks = LongStream.range(1, 302).boxed().collect(Collectors.toMap(it -> it, String::valueOf));
request.setBackLinks(backLinks);
final MvcResult mvcResult = mockMvc.perform(post("/v1/bts/superadmin_personal/10/ticket").with(token(oAuthHelper.getSuperadminToken())).contentType(MediaType.APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().isBadRequest()).andReturn();
ErrorRS error = objectMapper.readValue(mvcResult.getResponse().getContentAsString(), ErrorRS.class);
assertEquals(INCORRECT_REQUEST, error.getErrorType());
assertEquals(INCORRECT_REQUEST_MESSAGE + "[Field 'backLinks' should have size from '0' to '300'.] ", error.getMessage());
}
use of com.epam.ta.reportportal.ws.model.ErrorRS in project service-api by reportportal.
the class DashboardControllerValidationTest method createDashboardShouldReturnErrorWhenNameIsLessThanThreeCharacters.
@Test
public void createDashboardShouldReturnErrorWhenNameIsLessThanThreeCharacters() throws Exception {
// GIVEN
CreateDashboardRQ createDashboardRQ = new CreateDashboardRQ();
createDashboardRQ.setName(SHORT_NAME_VALUE);
// WHEN
MvcResult mvcResult = mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + DASHBOARD_PATH).with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(createDashboardRQ)).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());
}
use of com.epam.ta.reportportal.ws.model.ErrorRS in project service-api by reportportal.
the class DashboardControllerValidationTest method updateDashboardShouldReturnErrorWhenNameIsLessThanThreeCharacters.
@Test
public void updateDashboardShouldReturnErrorWhenNameIsLessThanThreeCharacters() throws Exception {
// GIVEN
CreateDashboardRQ createDashboardRQ = new CreateDashboardRQ();
createDashboardRQ.setName(SHORT_NAME_VALUE);
// WHEN
MvcResult mvcResult = mockMvc.perform(put(DEFAULT_PROJECT_BASE_URL + DASHBOARD_PATH + ID_PATH).with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(createDashboardRQ)).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