ScannerServiceImpl implements ScannerService { @Override public List<Scanner> getAll() { return scannerDAO.findAll(); } @Autowired  ScannerServiceImpl(ScannerDAO scannerDAO, ScannerAppDAO scannerAppDAO); @Override Scanner insert(Scanner scanner); @Override Scanner update(Scanner scanner); @Override Scanner getById(String scannerId); @Override List<Scanner> getAll(); @Override List<ScannerApp> getAppsByScannerAndAssignedProduct(Scanner scanner, String productName); @Override void removeByScannerId(String scannerId);  }
@Test(dataProvider = "getScannerData", dataProviderClass = ServiceTestDataProvider.class) public void testGetAll(Scanner testScanner) { List<Scanner> scannerList = new ArrayList<>(); scannerList.add(testScanner); Mockito.when(mockScannerDAO.findAll()).thenReturn(scannerList); List<Scanner> returnedScanners = scannerService.getAll(); Assert.assertNotNull(returnedScanners); Assert.assertFalse(returnedScanners.isEmpty()); }