Skip to content

Commit

Permalink
Added storage.clear
Browse files Browse the repository at this point in the history
  • Loading branch information
HovorukhaBohdan committed Oct 25, 2023
1 parent 8e9f338 commit 3348402
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 1 deletion.
1 change: 0 additions & 1 deletion report.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
fruit,quantity
banana,10
apple,100
pineapple,111
grape,150
melon,10
6 changes: 6 additions & 0 deletions src/test/java/core/basesyntax/db/dao/StorageDaoImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import core.basesyntax.db.Storage;
import java.util.Map;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -44,4 +45,9 @@ void storageDaoGet_twoFruits_Ok() {

assertEquals(expected, actual);
}

@AfterEach
void tearDown() {
Storage.fruitsCount.clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import static org.junit.Assert.assertEquals;

import core.basesyntax.db.Storage;
import core.basesyntax.db.dao.StorageDao;
import core.basesyntax.db.dao.StorageDaoImpl;
import core.basesyntax.service.CreateReportService;
import core.basesyntax.service.DataConvertService;
import core.basesyntax.service.DataProcessService;
import core.basesyntax.service.ReadFromCsvFileService;
import java.util.Map;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -94,4 +96,9 @@ void createReport_fourFruits_Ok() {

assertEquals(expected, actual);
}

@AfterEach
void tearDown() {
Storage.fruitsCount.clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;

import core.basesyntax.db.Storage;
import core.basesyntax.model.FruitTransaction;
import core.basesyntax.model.Operation;
import core.basesyntax.service.DataConvertService;
import core.basesyntax.service.DataProcessService;
import core.basesyntax.service.ReadFromCsvFileService;
import java.util.List;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -70,4 +72,9 @@ void dataProcessor_lessThenZero_NotOk() {
assertThrows(RuntimeException.class, () -> dataProcessor.processFruits(
dataConverter.convert(csvReader.readFile(FOURTH_FILENAME))));
}

@AfterEach
void tearDown() {
Storage.fruitsCount.clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import static org.junit.Assert.assertEquals;

import core.basesyntax.db.Storage;
import core.basesyntax.service.ReadFromCsvFileService;
import java.util.List;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -53,4 +55,9 @@ void csvReader_fourFruits_Ok() {

assertEquals(expected, actual);
}

@AfterEach
void tearDown() {
Storage.fruitsCount.clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.junit.Assert.assertEquals;

import core.basesyntax.db.Storage;
import core.basesyntax.service.CreateReportService;
import core.basesyntax.service.DataConvertService;
import core.basesyntax.service.DataProcessService;
Expand All @@ -10,6 +11,7 @@
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -111,4 +113,9 @@ void csvWriter_fourFruits_Ok() {

assertEquals(expected, actual);
}

@AfterEach
void tearDown() {
Storage.fruitsCount.clear();
}
}

0 comments on commit 3348402

Please sign in to comment.