use of com.epam.ta.reportportal.ws.model.issue.Issue in project service-api by reportportal.
the class TestItemControllerValidationTest method shouldReturnBadRequestWhenMoreThan300ItemIdsToLink.
@Test
public void shouldReturnBadRequestWhenMoreThan300ItemIdsToLink() throws Exception {
// GIVEN
final LinkExternalIssueRQ linkExternalIssueRQ = new LinkExternalIssueRQ();
final Issue.ExternalSystemIssue externalSystemIssue = getExternalSystemIssue();
linkExternalIssueRQ.setIssues(List.of(externalSystemIssue));
final List<Long> itemIds = Stream.generate(() -> 1L).limit(301).collect(Collectors.toList());
linkExternalIssueRQ.setTestItemIds(itemIds);
// WHEN
MvcResult mvcResult = mockMvc.perform(put(DEFAULT_PROJECT_BASE_URL + ITEM_PATH + "/issue/link").with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(linkExternalIssueRQ)).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 'testItemIds' should have size from '0' to '300'.] ", error.getMessage());
}
use of com.epam.ta.reportportal.ws.model.issue.Issue in project service-api by reportportal.
the class IssueConverterTest method toResource.
@Test
void toResource() {
final Issue issue = getIssue();
final IssueEntity issueEntity = IssueConverter.TO_ISSUE.apply(issue);
assertEquals(issueEntity.getIgnoreAnalyzer(), issue.getIgnoreAnalyzer());
assertEquals(issueEntity.getAutoAnalyzed(), issue.getAutoAnalyzed());
assertEquals(issue.getComment(), issue.getComment());
}
use of com.epam.ta.reportportal.ws.model.issue.Issue in project service-api by reportportal.
the class TicketConverterTest method toTicket.
@Test
void toTicket() {
final Issue.ExternalSystemIssue issue = getIssue();
final Ticket resource = TicketConverter.TO_TICKET.apply(issue);
assertEquals(resource.getTicketId(), issue.getTicketId());
assertEquals(resource.getUrl(), issue.getUrl());
assertEquals(resource.getBtsUrl(), issue.getBtsUrl());
assertEquals(resource.getBtsProject(), issue.getBtsProject());
}
Aggregations