Search in sources :

Example 1 with TicketInput

use of io.gravitee.rest.api.portal.rest.model.TicketInput in project gravitee-management-rest-api by gravitee-io.

the class TicketMapperTest method testConvert.

@Test
public void testConvert() {
    TicketMapper ticketMapper = new TicketMapper();
    TicketInput input = new TicketInput().api(TICKET_API).application(TICKET_APPLICATION).content(TICKET_CONTENT).subject(TICKET_SUBJECT).copyToSender(Boolean.TRUE);
    NewTicketEntity ticketEntity = ticketMapper.convert(input);
    assertNotNull(ticketEntity);
    assertEquals(TICKET_API, ticketEntity.getApi());
    assertEquals(TICKET_APPLICATION, ticketEntity.getApplication());
    assertEquals(TICKET_CONTENT, ticketEntity.getContent());
    assertEquals(TICKET_SUBJECT, ticketEntity.getSubject());
    assertTrue(ticketEntity.isCopyToSender());
}
Also used : TicketInput(io.gravitee.rest.api.portal.rest.model.TicketInput) NewTicketEntity(io.gravitee.rest.api.model.NewTicketEntity) Test(org.junit.Test)

Example 2 with TicketInput

use of io.gravitee.rest.api.portal.rest.model.TicketInput in project gravitee-management-rest-api by gravitee-io.

the class TicketsResourceTest method shouldCreate.

@Test
public void shouldCreate() {
    resetAllMocks();
    TicketInput input = new TicketInput().subject("A").content("B");
    final Response response = target().request().post(Entity.json(input));
    assertEquals(HttpStatusCode.CREATED_201, response.getStatus());
    assertNull(response.getHeaders().getFirst(HttpHeaders.LOCATION));
    verify(ticketMapper).convert(input);
    verify(ticketService).create(eq(USER_NAME), any(), eq("DEFAULT"), eq(ParameterReferenceType.ENVIRONMENT));
}
Also used : TicketInput(io.gravitee.rest.api.portal.rest.model.TicketInput) TicketsResponse(io.gravitee.rest.api.portal.rest.model.TicketsResponse) Response(javax.ws.rs.core.Response) Test(org.junit.Test)

Aggregations

TicketInput (io.gravitee.rest.api.portal.rest.model.TicketInput)2 Test (org.junit.Test)2 NewTicketEntity (io.gravitee.rest.api.model.NewTicketEntity)1 TicketsResponse (io.gravitee.rest.api.portal.rest.model.TicketsResponse)1 Response (javax.ws.rs.core.Response)1