@Test public void testAddNewDataAndSortByDefault() throws Exception { // given Product expectedProductFirst = new Product(1, 4.14, "ritona", "12.10.2015"); Product expectedProductLast = new Product(5, 3.14, "bizona", "12.10.2017"); // when csvHolder.addNewDataAndSortBy( "./src/test/resources/test.csv", products, CSVHolderImpl.CompareType.DEFAULT); // then assertEquals( expectedProductFirst, csvReader.readFromFile("./src/test/resources/test.csv").get(0)); assertEquals( expectedProductLast, csvReader.readFromFile("./src/test/resources/test.csv").get(4)); }
@Before public void setUp() throws Exception { csvHolder = new CSVHolderImpl(); csvReader = new CSVReaderImpl(); products = csvReader.readFromFile("./src/test/resources/product.csv"); file = new File("./src/test/resources/test.csv"); }