Search in sources :

Example 1 with CertificateSerialCurator

use of org.candlepin.model.CertificateSerialCurator in project candlepin by candlepin.

the class CertificateSerialResourceTest method getSerial.

@Test
public void getSerial() {
    CertificateSerialCurator csc = mock(CertificateSerialCurator.class);
    CertificateSerialResource csr = new CertificateSerialResource(csc, this.modelTranslator);
    CertificateSerial cs = new CertificateSerial(10L);
    when(csc.find(cs.getId())).thenReturn(cs);
    CertificateSerialDTO output = csr.getCertificateSerial(10L);
    assertNotNull(output);
    CertificateSerialDTO dto = this.modelTranslator.translate(cs, CertificateSerialDTO.class);
    assertEquals(dto, output);
}
Also used : CertificateSerialDTO(org.candlepin.dto.api.v1.CertificateSerialDTO) CertificateSerial(org.candlepin.model.CertificateSerial) CertificateSerialCurator(org.candlepin.model.CertificateSerialCurator) Test(org.junit.Test)

Example 2 with CertificateSerialCurator

use of org.candlepin.model.CertificateSerialCurator in project candlepin by candlepin.

the class CertificateSerialResourceTest method listall.

@Test
public void listall() {
    CandlepinQuery cqmock = new EmptyCandlepinQuery();
    CertificateSerialCurator csc = mock(CertificateSerialCurator.class);
    when(csc.listAll()).thenReturn(cqmock);
    CertificateSerialResource csr = new CertificateSerialResource(csc, this.modelTranslator);
    CandlepinQuery<CertificateSerialDTO> result = csr.getCertificateSerials();
    assertNotNull(result);
    verify(csc, times(1)).listAll();
}
Also used : CertificateSerialDTO(org.candlepin.dto.api.v1.CertificateSerialDTO) CandlepinQuery(org.candlepin.model.CandlepinQuery) EmptyCandlepinQuery(org.candlepin.model.EmptyCandlepinQuery) EmptyCandlepinQuery(org.candlepin.model.EmptyCandlepinQuery) CertificateSerialCurator(org.candlepin.model.CertificateSerialCurator) Test(org.junit.Test)

Aggregations

CertificateSerialDTO (org.candlepin.dto.api.v1.CertificateSerialDTO)2 CertificateSerialCurator (org.candlepin.model.CertificateSerialCurator)2 Test (org.junit.Test)2 CandlepinQuery (org.candlepin.model.CandlepinQuery)1 CertificateSerial (org.candlepin.model.CertificateSerial)1 EmptyCandlepinQuery (org.candlepin.model.EmptyCandlepinQuery)1