Search in sources :

Example 21 with Issue

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());
}
Also used : LinkExternalIssueRQ(com.epam.ta.reportportal.ws.model.item.LinkExternalIssueRQ) Issue(com.epam.ta.reportportal.ws.model.issue.Issue) ErrorRS(com.epam.ta.reportportal.ws.model.ErrorRS) MvcResult(org.springframework.test.web.servlet.MvcResult) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest) Test(org.junit.jupiter.api.Test)

Example 22 with Issue

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());
}
Also used : Issue(com.epam.ta.reportportal.ws.model.issue.Issue) IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity) Test(org.junit.jupiter.api.Test)

Example 23 with Issue

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());
}
Also used : Ticket(com.epam.ta.reportportal.entity.bts.Ticket) Issue(com.epam.ta.reportportal.ws.model.issue.Issue) Test(org.junit.jupiter.api.Test)

Aggregations

Issue (com.epam.ta.reportportal.ws.model.issue.Issue)23 Test (org.junit.jupiter.api.Test)19 BaseMvcTest (com.epam.ta.reportportal.ws.BaseMvcTest)15 FinishTestItemRQ (com.epam.ta.reportportal.ws.model.FinishTestItemRQ)10 IssueEntity (com.epam.ta.reportportal.entity.item.issue.IssueEntity)4 LinkExternalIssueRQ (com.epam.ta.reportportal.ws.model.item.LinkExternalIssueRQ)4 TestItem (com.epam.ta.reportportal.entity.item.TestItem)3 IssueDefinition (com.epam.ta.reportportal.ws.model.issue.IssueDefinition)3 IssueType (com.epam.ta.reportportal.entity.item.issue.IssueType)2 Launch (com.epam.ta.reportportal.entity.launch.Launch)2 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)2 ErrorRS (com.epam.ta.reportportal.ws.model.ErrorRS)2 DefineIssueRQ (com.epam.ta.reportportal.ws.model.issue.DefineIssueRQ)2 MvcResult (org.springframework.test.web.servlet.MvcResult)2 TO_LOCAL_DATE_TIME (com.epam.ta.reportportal.commons.EntityUtils.TO_LOCAL_DATE_TIME)1 Preconditions (com.epam.ta.reportportal.commons.Preconditions)1 Predicates.equalTo (com.epam.ta.reportportal.commons.Predicates.equalTo)1 ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)1 BusinessRule.expect (com.epam.ta.reportportal.commons.validation.BusinessRule.expect)1 BusinessRuleViolationException (com.epam.ta.reportportal.commons.validation.BusinessRuleViolationException)1