PTVProgramStockInformationRepository { public boolean save(List<PTVProgramStockInformation> ptvProgramStocksInformation) throws LMISException { return genericDao.create(ptvProgramStocksInformation); } @Inject  PTVProgramStockInformationRepository(Context context); boolean save(List<PTVProgramStockInformation> ptvProgramStocksInformation);  }
@Test public void shouldSavePTVProgramStocksInformationWhenPTVProgramAndProductExist() throws LMISException { ptvProgram.setId(10L); product.setId(2L); PTVProgramStockInformation ptvProgramStockInformation = new PTVProgramStockInformation(); ptvProgramStockInformation.setProduct(product); ptvProgramStockInformation.setPtvProgram(ptvProgram); PTVProgramStockInformation ptvProgramStockInformation2 = new PTVProgramStockInformation(); ptvProgramStockInformation2.setProduct(product); ptvProgramStockInformation2.setPtvProgram(ptvProgram); List<PTVProgramStockInformation> ptvProgramStocksInformation = newArrayList(ptvProgramStockInformation, ptvProgramStockInformation2); boolean isPTVProgramStockInformationSaved = ptvProgramStockInformationRepository.save(ptvProgramStocksInformation); assertThat(isPTVProgramStockInformationSaved, is(true)); }
@Test (expected = LMISException.class) public void shouldThrowExceptionSavingPTVProgramStocksInformationWhenPTVProgramDoNotExist() throws LMISException { PTVProgramStockInformation ptvProgramStockInformation = new PTVProgramStockInformation(); PTVProgramStockInformation ptvProgramStockInformation2 = new PTVProgramStockInformation(); List<PTVProgramStockInformation> ptvProgramStocksInformation = newArrayList(ptvProgramStockInformation, ptvProgramStockInformation2); ptvProgramStockInformationRepository.save(ptvProgramStocksInformation); }