ScanServiceImpl implements ScanService { @Override public List<Scan> getByStatusesAndScannerAndProduct(List<ScanStatus> statuses, Scanner scanner, String product) { return scanDAO.getByStatusInAndScannerAndProduct(statuses, scanner, product); } @Autowired  ScanServiceImpl(ScanDAO scanDAO); @Override Scan update(Scan scan); @Override Scan insert(Scan scan); @Override Page<Scan> getAll(Integer pageNumber, Integer pageSize); @Override Scan getByJobId(String jobId); @Override void updateStatus(String jobId, ScanStatus status); @Override void updatePriority(String jobId, ScanPriority priority); @Override void updateScannerAppId(String jobId, String scannerAppId); @Override List<Scan> getByStatus(ScanStatus status); @Override List<Scan> getPendingScans(ScanStatus status); @Override List<Scan> getByStatusesAndScannerAndProduct(List<ScanStatus> statuses, Scanner scanner, String product);  }
@Test(dataProvider = "getScanData", dataProviderClass = ServiceTestDataProvider.class) public void testGetByStatusesAndScannerAndProduct(Scan scan) { Mockito.when(mockScanDAO.getByStatusInAndScannerAndProduct(Collections .singletonList(ScanStatus.SUBMIT_PENDING), scan.getScanner(), scan.getProduct())).thenReturn(Collections.singletonList(scan)); List<Scan> retrievedScans = scanService.getByStatusesAndScannerAndProduct(Collections .singletonList(ScanStatus.SUBMIT_PENDING), scan.getScanner(), scan.getProduct()); Assert.assertNotNull(retrievedScans); Assert.assertFalse(retrievedScans.isEmpty()); Assert.assertEquals(scan.getStatus(), retrievedScans.get(0).getStatus()); }