use of com.synopsys.integration.alert.common.rest.model.AlertPagedModel in project hub-alert by blackducksoftware.
the class JobConfigActionsTest method getPageTest.
@Test
public void getPageTest() throws Exception {
int totalPages = 1;
int pageNumber = 0;
int pageSize = 10;
RegisteredDescriptorModel registeredDescriptorModel = new RegisteredDescriptorModel(1L, "descriptorName", DESCRIPTOR_TYPE.name());
AlertPagedModel<DistributionJobModel> pageOfJobs = new AlertPagedModel<>(totalPages, pageNumber, pageSize, List.of(distributionJobModel));
Mockito.when(mockedDescriptorAccessor.getRegisteredDescriptors()).thenReturn(List.of(registeredDescriptorModel));
Mockito.when(mockedJobAccessor.getPageOfJobs(Mockito.anyInt(), Mockito.anyInt(), Mockito.anyString(), Mockito.anyCollection())).thenReturn(pageOfJobs);
Mockito.when(mockedConfigurationFieldModelConverter.convertToFieldModel(Mockito.any())).thenReturn(fieldModel);
ActionResponse<JobPagedModel> jobPagedModelActionResponse = defaultJobConfigActions.getPage(pageNumber, pageSize, "");
assertTrue(jobPagedModelActionResponse.isSuccessful());
assertTrue(jobPagedModelActionResponse.hasContent());
assertEquals(HttpStatus.OK, jobPagedModelActionResponse.getHttpStatus());
}
use of com.synopsys.integration.alert.common.rest.model.AlertPagedModel in project hub-alert by blackducksoftware.
the class AlertPagedRestModelTest method testRestModel.
@Test
public void testRestModel() {
final int totalPages = 2;
final int currentPage = 1;
final int pageSize = 2;
List<AuditEntryModel> contentList = new ArrayList<>();
AuditEntryModel item = new AuditEntryModel();
contentList.add(item);
contentList.add(item);
AlertPagedModel<AuditEntryModel> restModel = new AlertPagedModel<>(totalPages, currentPage, pageSize, contentList);
assertEquals(totalPages, restModel.getTotalPages());
assertEquals(currentPage, restModel.getCurrentPage());
assertEquals(pageSize, restModel.getPageSize());
assertEquals(contentList, restModel.getModels());
}
Aggregations