@Test public void shouldNotUpdateAverageMonthlyConsumption() throws Exception { LMISTestApp.getInstance().setCurrentTimeMillis(new DateTime().getMillis()); SharedPreferenceMgr.getInstance().updateLatestLowStockAvgTime(); List<StockCard> list = asList(new StockCard()); stockService.stockRepository = mockedStockRepository; stockService.cmmRepository = mockedCmmRepository; when(mockedStockRepository.list()).thenReturn(list); stockService.monthlyUpdateAvgMonthlyConsumption(); verify(mockedStockRepository, never()).createOrUpdate(any(StockCard.class)); verify(mockedCmmRepository, never()).save(any(Cmm.class)); }
public void monthlyUpdateAvgMonthlyConsumption() { DateTime recordLowStockAvgPeriod = SharedPreferenceMgr.getInstance().getLatestUpdateLowStockAvgTime(); Period period = Period.of(today()); if (recordLowStockAvgPeriod.isBefore(period.getBegin())) { immediatelyUpdateAvgMonthlyConsumption(); monthlyCheckAllMovement(); } }
StockService { public void monthlyUpdateAvgMonthlyConsumption() { DateTime recordLowStockAvgPeriod = SharedPreferenceMgr.getInstance().getLatestUpdateLowStockAvgTime(); Period period = Period.of(today()); if (recordLowStockAvgPeriod.isBefore(period.getBegin())) { immediatelyUpdateAvgMonthlyConsumption(); monthlyCheckAllMovement(); } } }
StockService { public void monthlyUpdateAvgMonthlyConsumption() { DateTime recordLowStockAvgPeriod = SharedPreferenceMgr.getInstance().getLatestUpdateLowStockAvgTime(); Period period = Period.of(today()); if (recordLowStockAvgPeriod.isBefore(period.getBegin())) { immediatelyUpdateAvgMonthlyConsumption(); monthlyCheckAllMovement(); } } StockService(); }
StockService { public void monthlyUpdateAvgMonthlyConsumption() { DateTime recordLowStockAvgPeriod = SharedPreferenceMgr.getInstance().getLatestUpdateLowStockAvgTime(); Period period = Period.of(today()); if (recordLowStockAvgPeriod.isBefore(period.getBegin())) { immediatelyUpdateAvgMonthlyConsumption(); monthlyCheckAllMovement(); } } StockService(); void monthlyUpdateAvgMonthlyConsumption(); void immediatelyUpdateAvgMonthlyConsumption(); }
StockService { public void monthlyUpdateAvgMonthlyConsumption() { DateTime recordLowStockAvgPeriod = SharedPreferenceMgr.getInstance().getLatestUpdateLowStockAvgTime(); Period period = Period.of(today()); if (recordLowStockAvgPeriod.isBefore(period.getBegin())) { immediatelyUpdateAvgMonthlyConsumption(); monthlyCheckAllMovement(); } } StockService(); void monthlyUpdateAvgMonthlyConsumption(); void immediatelyUpdateAvgMonthlyConsumption();  }