@Test public void serviceReturnsOneDeviceLogItem() { final Slice<DeviceLogItem> mockSlice = this.mockSliceOfDeviceLogItems(1); final PageRequest pageRequest = PageRequest.of(0, 10, Sort.Direction.DESC, "id"); Mockito.when(this.deviceLogItemSlicingRepository.findByCreationTimeBefore(this.now, pageRequest)) .thenReturn(mockSlice); final List<DeviceLogItem> deviceLogItems = this.transactionalDeviceLogItemService .findDeviceLogItemsBeforeDate(this.now, 10); assertThat(deviceLogItems.size()).isEqualTo(1); }
public List<DeviceLogItem> findDeviceLogItemsBeforeDate(final Date date, final int pageSize) { final PageRequest pageRequest = PageRequest.of(0, pageSize, Sort.Direction.DESC, "id"); final Slice<DeviceLogItem> slice = this.deviceLogItemSlicingRepository.findByCreationTimeBefore(date, pageRequest); final List<DeviceLogItem> deviceLogItems = slice.getContent(); LOGGER.info("Found {} device log items with date time before {}.", deviceLogItems.size(), date); return deviceLogItems; }
TransactionalDeviceLogItemService { public List<DeviceLogItem> findDeviceLogItemsBeforeDate(final Date date, final int pageSize) { final PageRequest pageRequest = PageRequest.of(0, pageSize, Sort.Direction.DESC, "id"); final Slice<DeviceLogItem> slice = this.deviceLogItemSlicingRepository.findByCreationTimeBefore(date, pageRequest); final List<DeviceLogItem> deviceLogItems = slice.getContent(); LOGGER.info("Found {} device log items with date time before {}.", deviceLogItems.size(), date); return deviceLogItems; } }
TransactionalDeviceLogItemService { public List<DeviceLogItem> findDeviceLogItemsBeforeDate(final Date date, final int pageSize) { final PageRequest pageRequest = PageRequest.of(0, pageSize, Sort.Direction.DESC, "id"); final Slice<DeviceLogItem> slice = this.deviceLogItemSlicingRepository.findByCreationTimeBefore(date, pageRequest); final List<DeviceLogItem> deviceLogItems = slice.getContent(); LOGGER.info("Found {} device log items with date time before {}.", deviceLogItems.size(), date); return deviceLogItems; }  }
TransactionalDeviceLogItemService { public List<DeviceLogItem> findDeviceLogItemsBeforeDate(final Date date, final int pageSize) { final PageRequest pageRequest = PageRequest.of(0, pageSize, Sort.Direction.DESC, "id"); final Slice<DeviceLogItem> slice = this.deviceLogItemSlicingRepository.findByCreationTimeBefore(date, pageRequest); final List<DeviceLogItem> deviceLogItems = slice.getContent(); LOGGER.info("Found {} device log items with date time before {}.", deviceLogItems.size(), date); return deviceLogItems; }  List<DeviceLogItem> findDeviceLogItemsBeforeDate(final Date date, final int pageSize); void deleteDeviceLogItems(final List<DeviceLogItem> deviceLogItems); }
TransactionalDeviceLogItemService { public List<DeviceLogItem> findDeviceLogItemsBeforeDate(final Date date, final int pageSize) { final PageRequest pageRequest = PageRequest.of(0, pageSize, Sort.Direction.DESC, "id"); final Slice<DeviceLogItem> slice = this.deviceLogItemSlicingRepository.findByCreationTimeBefore(date, pageRequest); final List<DeviceLogItem> deviceLogItems = slice.getContent(); LOGGER.info("Found {} device log items with date time before {}.", deviceLogItems.size(), date); return deviceLogItems; }  List<DeviceLogItem> findDeviceLogItemsBeforeDate(final Date date, final int pageSize); void deleteDeviceLogItems(final List<DeviceLogItem> deviceLogItems);  }