@Test public void shouldGetAll() { List<ProductCategory> categories = asList(new ProductCategory()); when(mapper.getAll()).thenReturn(categories); List<ProductCategory> returnedCategories = repository.getAll(); verify(mapper).getAll(); assertThat(returnedCategories, is(categories)); }
public List<ProductCategory> getAll() { return mapper.getAll(); }
ProductCategoryRepository { public List<ProductCategory> getAll() { return mapper.getAll(); } }
ProductCategoryRepository { public List<ProductCategory> getAll() { return mapper.getAll(); } @Autowired  ProductCategoryRepository(ProductCategoryMapper mapper); }
ProductCategoryRepository { public List<ProductCategory> getAll() { return mapper.getAll(); } @Autowired  ProductCategoryRepository(ProductCategoryMapper mapper); void insert(ProductCategory productCategory); void update(ProductCategory productCategory); ProductCategory getExisting(ProductCategory productCategory); Long getIdByCode(String categoryCode); ProductCategory getByCode(String code); List<ProductCategory> getAll(); ProductCategory getById(Long id); }
ProductCategoryRepository { public List<ProductCategory> getAll() { return mapper.getAll(); } @Autowired  ProductCategoryRepository(ProductCategoryMapper mapper); void insert(ProductCategory productCategory); void update(ProductCategory productCategory); ProductCategory getExisting(ProductCategory productCategory); Long getIdByCode(String categoryCode); ProductCategory getByCode(String code); List<ProductCategory> getAll(); ProductCategory getById(Long id);  }