@Test public void shouldReturnProductByCode() { Product product = new Product(); String productCode = "P1"; when(mockedMapper.getByCode(productCode)).thenReturn(product); Product returnedProduct = repository.getByCode(productCode); assertThat(returnedProduct, is(product)); }
public Product getByCode(String code) { return mapper.getByCode(code); }
ProductRepository { public Product getByCode(String code) { return mapper.getByCode(code); } }
ProductRepository { public Product getByCode(String code) { return mapper.getByCode(code); }  }
ProductRepository { public Product getByCode(String code) { return mapper.getByCode(code); }  void insert(Product product); void update(Product product); Long getIdByCode(String code); Product getByCode(String code); DosageUnit getDosageUnitByCode(String code); boolean isActive(String code); Integer getTotalSearchResultCount(String searchParam); List<DosageUnit> getAllDosageUnits(); Product getById(Long id); }
ProductRepository { public Product getByCode(String code) { return mapper.getByCode(code); }  void insert(Product product); void update(Product product); Long getIdByCode(String code); Product getByCode(String code); DosageUnit getDosageUnitByCode(String code); boolean isActive(String code); Integer getTotalSearchResultCount(String searchParam); List<DosageUnit> getAllDosageUnits(); Product getById(Long id);  }