@Test public void shouldNotGenerateFirstPeriodIfNoMovement() throws Exception { when(mockStockMovementRepository.getFirstStockMovement()).thenReturn(null); assertThat(periodService.getFirstStandardPeriod().isPresent(), is(false)); }
public Optional<Period> getFirstStandardPeriod() throws LMISException { StockMovementItem firstStockMovement = stockMovementRepository.getFirstStockMovement(); if (firstStockMovement != null) { Period firstPeriod = firstStockMovement.getMovementPeriod(); if (firstPeriod != null && firstPeriod.isOpenToRequisitions()) { return Optional.of(firstPeriod); } } return Optional.absent(); }
ProgramDataFormPeriodService { public Optional<Period> getFirstStandardPeriod() throws LMISException { StockMovementItem firstStockMovement = stockMovementRepository.getFirstStockMovement(); if (firstStockMovement != null) { Period firstPeriod = firstStockMovement.getMovementPeriod(); if (firstPeriod != null && firstPeriod.isOpenToRequisitions()) { return Optional.of(firstPeriod); } } return Optional.absent(); } }
ProgramDataFormPeriodService { public Optional<Period> getFirstStandardPeriod() throws LMISException { StockMovementItem firstStockMovement = stockMovementRepository.getFirstStockMovement(); if (firstStockMovement != null) { Period firstPeriod = firstStockMovement.getMovementPeriod(); if (firstPeriod != null && firstPeriod.isOpenToRequisitions()) { return Optional.of(firstPeriod); } } return Optional.absent(); }  }
ProgramDataFormPeriodService { public Optional<Period> getFirstStandardPeriod() throws LMISException { StockMovementItem firstStockMovement = stockMovementRepository.getFirstStockMovement(); if (firstStockMovement != null) { Period firstPeriod = firstStockMovement.getMovementPeriod(); if (firstPeriod != null && firstPeriod.isOpenToRequisitions()) { return Optional.of(firstPeriod); } } return Optional.absent(); }  Optional<Period> getFirstStandardPeriod(); }
ProgramDataFormPeriodService { public Optional<Period> getFirstStandardPeriod() throws LMISException { StockMovementItem firstStockMovement = stockMovementRepository.getFirstStockMovement(); if (firstStockMovement != null) { Period firstPeriod = firstStockMovement.getMovementPeriod(); if (firstPeriod != null && firstPeriod.isOpenToRequisitions()) { return Optional.of(firstPeriod); } } return Optional.absent(); }  Optional<Period> getFirstStandardPeriod();  }