@Test public void shouldGetProgramProductIdByProgramAndProductId() { when(programProductMapper.getIdByProgramAndProductId(1L, 2L)).thenReturn(3L); assertThat(programProductRepository.getIdByProgramIdAndProductId(1L, 2L), is(3L)); verify(programProductMapper).getIdByProgramAndProductId(1L, 2L); }
public Long getIdByProgramIdAndProductId(Long programId, Long productId) { Long programProductId = mapper.getIdByProgramAndProductId(programId, productId); if (programProductId == null) throw new DataException("programProduct.product.program.invalid"); return programProductId; }
ProgramProductRepository { public Long getIdByProgramIdAndProductId(Long programId, Long productId) { Long programProductId = mapper.getIdByProgramAndProductId(programId, productId); if (programProductId == null) throw new DataException("programProduct.product.program.invalid"); return programProductId; } }
ProgramProductRepository { public Long getIdByProgramIdAndProductId(Long programId, Long productId) { Long programProductId = mapper.getIdByProgramAndProductId(programId, productId); if (programProductId == null) throw new DataException("programProduct.product.program.invalid"); return programProductId; }  }
ProgramProductRepository { public Long getIdByProgramIdAndProductId(Long programId, Long productId) { Long programProductId = mapper.getIdByProgramAndProductId(programId, productId); if (programProductId == null) throw new DataException("programProduct.product.program.invalid"); return programProductId; }  void save(ProgramProduct programProduct); Long getIdByProgramIdAndProductId(Long programId, Long productId); void updateCurrentPrice(ProgramProduct programProduct); ProgramProduct getByProgramAndProductCode(ProgramProduct programProduct); ProgramProduct getByProgramAndProductId(Long programId, Long productId); void updatePriceHistory(ProgramProductPrice programProductPrice); void updateProgramProduct(ProgramProduct programProduct); ProgramProductPrice getProgramProductPrice(ProgramProduct programProduct); List<ProgramProduct> getByProgram(Program program); ProgramProduct getById(Long id); List<ProgramProduct> getByProductCode(String code); List<ProgramProduct> getProgramProductsBy(Long programId, String facilityTypeCode); List<ProgramProduct> getNonFullSupplyProductsForProgram(Program program); List<ProgramProduct> searchByProgram(String searchParam, Pagination pagination); Integer getTotalSearchResultCount(String searchParam); List<ProgramProduct> searchByProduct(String searchParam, Pagination pagination); List<ProgramProduct> getActiveByProgram(Long programId); @Transactional void insertISA(ProgramProductISA programProductISA); void updateISA(ProgramProductISA programProductISA); }
ProgramProductRepository { public Long getIdByProgramIdAndProductId(Long programId, Long productId) { Long programProductId = mapper.getIdByProgramAndProductId(programId, productId); if (programProductId == null) throw new DataException("programProduct.product.program.invalid"); return programProductId; }  void save(ProgramProduct programProduct); Long getIdByProgramIdAndProductId(Long programId, Long productId); void updateCurrentPrice(ProgramProduct programProduct); ProgramProduct getByProgramAndProductCode(ProgramProduct programProduct); ProgramProduct getByProgramAndProductId(Long programId, Long productId); void updatePriceHistory(ProgramProductPrice programProductPrice); void updateProgramProduct(ProgramProduct programProduct); ProgramProductPrice getProgramProductPrice(ProgramProduct programProduct); List<ProgramProduct> getByProgram(Program program); ProgramProduct getById(Long id); List<ProgramProduct> getByProductCode(String code); List<ProgramProduct> getProgramProductsBy(Long programId, String facilityTypeCode); List<ProgramProduct> getNonFullSupplyProductsForProgram(Program program); List<ProgramProduct> searchByProgram(String searchParam, Pagination pagination); Integer getTotalSearchResultCount(String searchParam); List<ProgramProduct> searchByProduct(String searchParam, Pagination pagination); List<ProgramProduct> getActiveByProgram(Long programId); @Transactional void insertISA(ProgramProductISA programProductISA); void updateISA(ProgramProductISA programProductISA);  }