@Test public void shouldScanAllMovementAndDeleteTheWrongMovement() throws LMISException { List<StockCard> list = Arrays.asList(stockCard3, stockCard4); List<StockMovementItem> stockMovementItems3 = Arrays.asList(stockMovementItem31, stockMovementItem32); List<StockMovementItem> stockMovementItems4 = Arrays.asList(stockMovementItem41, stockMovementItem42, stockMovementItem43); when(stockRepository.list()).thenReturn(list); when(stockMovementRepository.queryMovementByStockCardId(3)).thenReturn(stockMovementItems3); when(stockMovementRepository.queryMovementByStockCardId(4)).thenReturn(stockMovementItems4); List<StockCard> wrongStockCards = dirtyDataManager.scanAllStockMovements(); assertThat(wrongStockCards.size(), is(1)); assertThat(wrongStockCards.get(0).getProduct().getCode(), is("productCode4")); }
public List<StockCard> scanAllStockMovements() { List<StockCard> stockCards = stockRepository.list(); List<StockCard> deletedStockCards = checkAllMovementAndLotSOHAndSaveToDB(stockCards); List<String> productCodes = getCodeFromStockCard(deletedStockCards); deleteAndReset(productCodes); sharedPreferenceMgr.setDeletedProduct(productCodes); return deletedStockCards; }
DirtyDataManager { public List<StockCard> scanAllStockMovements() { List<StockCard> stockCards = stockRepository.list(); List<StockCard> deletedStockCards = checkAllMovementAndLotSOHAndSaveToDB(stockCards); List<String> productCodes = getCodeFromStockCard(deletedStockCards); deleteAndReset(productCodes); sharedPreferenceMgr.setDeletedProduct(productCodes); return deletedStockCards; } }
DirtyDataManager { public List<StockCard> scanAllStockMovements() { List<StockCard> stockCards = stockRepository.list(); List<StockCard> deletedStockCards = checkAllMovementAndLotSOHAndSaveToDB(stockCards); List<String> productCodes = getCodeFromStockCard(deletedStockCards); deleteAndReset(productCodes); sharedPreferenceMgr.setDeletedProduct(productCodes); return deletedStockCards; } DirtyDataManager(); }
DirtyDataManager { public List<StockCard> scanAllStockMovements() { List<StockCard> stockCards = stockRepository.list(); List<StockCard> deletedStockCards = checkAllMovementAndLotSOHAndSaveToDB(stockCards); List<String> productCodes = getCodeFromStockCard(deletedStockCards); deleteAndReset(productCodes); sharedPreferenceMgr.setDeletedProduct(productCodes); return deletedStockCards; } DirtyDataManager(); List<StockCard> correctData(); List<StockCard> correctDataForStockCardOverView(List<StockCard> stockCards); List<StockCard> scanAllStockMovements(); }
DirtyDataManager { public List<StockCard> scanAllStockMovements() { List<StockCard> stockCards = stockRepository.list(); List<StockCard> deletedStockCards = checkAllMovementAndLotSOHAndSaveToDB(stockCards); List<String> productCodes = getCodeFromStockCard(deletedStockCards); deleteAndReset(productCodes); sharedPreferenceMgr.setDeletedProduct(productCodes); return deletedStockCards; } DirtyDataManager(); List<StockCard> correctData(); List<StockCard> correctDataForStockCardOverView(List<StockCard> stockCards); List<StockCard> scanAllStockMovements();  }