ScannerServiceImpl implements ScannerService { @Override public Scanner getById(String scannerId) { return scannerDAO.getScannerById(scannerId); } @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 testGetById(Scanner testScanner) { Mockito.when(mockScannerDAO.getScannerById(TEST_SCANNER_ID)).thenReturn(testScanner); Scanner insertedScanner = scannerService.getById(TEST_SCANNER_ID); Assert.assertNotNull(insertedScanner); Assert.assertEquals(TEST_SCANNER_ID, insertedScanner.getId()); }