@@ -0,0 +1,2973 @@
+package pl.koszela.jan.persistence.dao;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport java.util.List;%0Aimport org.assertj.core.util.Lists;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0Aimport org.mockito.junit.MockitoJUnitRunner;%0Aimport org.springframework.test.context.ActiveProfiles;%0Aimport pl.koszela.jan.persistence.converter.JsonConverter;%0Aimport pl.koszela.jan.persistence.dto.ProductDTO;%0Aimport pl.koszela.jan.persistence.dto.ProductListDTO;%0A%0A/**%0A * Created on 11.08.2017.%0A *%0A * @author Jan Koszela%0A */%0A@ActiveProfiles(%22test%22)%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class DefaultProductDAOIntegrationTest %7B%0A  @Mock%0A  private ProductDAO givenProductDAO;%0A%0A  @Mock%0A  private ProductListDTO productListDTO;%0A%0A  @Before%0A  public void setUp() %7B%0A  %7D%0A%0A%0A  @Test%0A  public void shouldGetAllItems() %7B%0A    //given%0A    List%3CProductDTO%3E expectedList = getProductListFromJson();%0A%0A    // when%0A    when(givenProductDAO.getAllItems()).thenReturn(expectedList);%0A%0A    // then%0A    assertThat(givenProductDAO.getAllItems()).hasSize(expectedList.size());%0A  %7D%0A%0A  @Test%0A  public void shouldGetItemsWhichContainsMultipricing() %7B%0A    //given%0A    List%3CProductDTO%3E expectedList = getProductsWithMultipricing();%0A%0A    // when%0A    when(givenProductDAO.getItemsByMultipricing(true)).thenReturn(expectedList);%0A%0A    // then%0A    assertThat(givenProductDAO.getItemsByMultipricing(true)).hasSize(expectedList.size());%0A  %7D%0A%0A%0A  @Test%0A  public void shouldGetItemsWhichHaveCurrencyInEuro() %7B%0A    //given%0A    List%3CProductDTO%3E expectedList = getProductsWithEURCurrency();%0A%0A    // when%0A    when(givenProductDAO.getItemsByMultipricing(true)).thenReturn(expectedList);%0A%0A    // then%0A    assertThat(givenProductDAO.getItemsByMultipricing(true)).hasSize(expectedList.size());%0A  %7D%0A%0A  private List%3CProductDTO%3E getProductListFromJson() %7B%0A    List%3CProductDTO%3E expected = Lists.newArrayList();%0A%0A    JsonConverter converter = new JsonConverter();%0A    converter.convert();%0A%0A    expected.addAll(converter.getProductList());%0A%0A    return expected;%0A  %7D%0A%0A  private List%3CProductDTO%3E getProductsWithMultipricing() %7B%0A    List%3CProductDTO%3E expected = getProductListFromJson();%0A%0A    for (int i = 0; i %3C expected.size(); i++) %7B%0A      if (hasNotItemMultipricing(expected, i)) %7B%0A        expected.remove(i);%0A      %7D%0A%0A    %7D%0A%0A    return expected;%0A  %7D%0A%0A  private boolean hasNotItemMultipricing(List%3CProductDTO%3E expected, int i) %7B%0A    return expected.get(i).isMultipricing() == false;%0A  %7D%0A%0A  private List%3CProductDTO%3E getProductsWithEURCurrency() %7B%0A    List%3CProductDTO%3E expected = getProductListFromJson();%0A%0A    for (int i = 0; i %3C expected.size(); i++) %7B%0A      if (isCurrencyDifferentThanEUR(expected, i)) %7B%0A        expected.remove(i);%0A      %7D%0A    %7D%0A%0A    return expected;%0A  %7D%0A%0A  private boolean isCurrencyDifferentThanEUR(List%3CProductDTO%3E expected, int i) %7B%0A    return !expected.get(i).getCurrency().equals(%22EUR%22);%0A  %7D%0A%7D%0A

Add integration test