From fbe8036b44582cd5da4f539c8704195e8f14bca5 Mon Sep 17 00:00:00 2001 From: Bogdan <97698639+don-bigdad@users.noreply.github.com> Date: Mon, 18 Sep 2023 17:11:31 +0300 Subject: [PATCH] checkstyle fix --- .../basesyntax/handler/BalanceOperationHandlerTest.java | 6 +++++- .../basesyntax/handler/PurchaseOperationHandlerTest.java | 1 + .../basesyntax/handler/ReturnOperationHandlerTest.java | 7 ++++++- .../basesyntax/handler/SupplyOperationHandlerTest.java | 5 ++++- .../service/impl/OperationProcessorServiceTest.java | 5 +++-- .../basesyntax/service/impl/ReportServiceImplTest.java | 1 + .../validation/impl/OutputValidatorImplTest.java | 3 +-- 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/test/java/core/basesyntax/handler/BalanceOperationHandlerTest.java b/src/test/java/core/basesyntax/handler/BalanceOperationHandlerTest.java index 9fe782bd3d..5821d5d40e 100644 --- a/src/test/java/core/basesyntax/handler/BalanceOperationHandlerTest.java +++ b/src/test/java/core/basesyntax/handler/BalanceOperationHandlerTest.java @@ -3,12 +3,16 @@ import core.basesyntax.db.Storage; import core.basesyntax.model.Fruit; import core.basesyntax.model.FruitTransaction; -import org.junit.jupiter.api.*; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; class BalanceOperationHandlerTest { private static Fruit apple; private static OperationHandler balanceOperationHandler; private static FruitTransaction fruitTransaction; + @BeforeAll static void setUp() { apple = new Fruit("apple"); diff --git a/src/test/java/core/basesyntax/handler/PurchaseOperationHandlerTest.java b/src/test/java/core/basesyntax/handler/PurchaseOperationHandlerTest.java index 59d748fa94..d47cf100b9 100644 --- a/src/test/java/core/basesyntax/handler/PurchaseOperationHandlerTest.java +++ b/src/test/java/core/basesyntax/handler/PurchaseOperationHandlerTest.java @@ -12,6 +12,7 @@ class PurchaseOperationHandlerTest { private static Fruit apple; private static OperationHandler purchaseOperationHandler; private static FruitTransaction fruitTransaction; + @BeforeAll static void setUp() { apple = new Fruit("apple"); diff --git a/src/test/java/core/basesyntax/handler/ReturnOperationHandlerTest.java b/src/test/java/core/basesyntax/handler/ReturnOperationHandlerTest.java index 9b77d1f21b..e8451f229e 100644 --- a/src/test/java/core/basesyntax/handler/ReturnOperationHandlerTest.java +++ b/src/test/java/core/basesyntax/handler/ReturnOperationHandlerTest.java @@ -3,17 +3,22 @@ import core.basesyntax.db.Storage; import core.basesyntax.model.Fruit; import core.basesyntax.model.FruitTransaction; -import org.junit.jupiter.api.*; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; class ReturnOperationHandlerTest { private static Fruit apple; private static OperationHandler returnOperationHandler; private static FruitTransaction fruitTransaction; + @BeforeAll static void setUp() { apple = new Fruit("apple"); returnOperationHandler = new ReturnOperationHandler(); fruitTransaction = new FruitTransaction(); + Storage.storage.clear(); } @AfterEach diff --git a/src/test/java/core/basesyntax/handler/SupplyOperationHandlerTest.java b/src/test/java/core/basesyntax/handler/SupplyOperationHandlerTest.java index fbb6304d36..baf08d3f9e 100644 --- a/src/test/java/core/basesyntax/handler/SupplyOperationHandlerTest.java +++ b/src/test/java/core/basesyntax/handler/SupplyOperationHandlerTest.java @@ -3,7 +3,10 @@ import core.basesyntax.db.Storage; import core.basesyntax.model.Fruit; import core.basesyntax.model.FruitTransaction; -import org.junit.jupiter.api.*; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; class SupplyOperationHandlerTest { private static Fruit apple; diff --git a/src/test/java/core/basesyntax/service/impl/OperationProcessorServiceTest.java b/src/test/java/core/basesyntax/service/impl/OperationProcessorServiceTest.java index 371b7819ac..47cca1df83 100644 --- a/src/test/java/core/basesyntax/service/impl/OperationProcessorServiceTest.java +++ b/src/test/java/core/basesyntax/service/impl/OperationProcessorServiceTest.java @@ -23,6 +23,7 @@ class OperationProcessorServiceTest { private static Map handlerMap; private static Fruit banana; private static Fruit apple; + @BeforeAll static void beforeAll() { banana = new Fruit("banana"); @@ -38,8 +39,8 @@ static void beforeAll() { @Test void processValidTransactions() { - int initialBananaBalance = Storage.storage.get(banana); - int initialAppleBalance = Storage.storage.get(apple); + final int initialBananaBalance = Storage.storage.get(banana); + final int initialAppleBalance = Storage.storage.get(apple); int quantity = 25; FruitTransaction transaction1 = new FruitTransaction(); transaction1.setFruit(banana); diff --git a/src/test/java/core/basesyntax/service/impl/ReportServiceImplTest.java b/src/test/java/core/basesyntax/service/impl/ReportServiceImplTest.java index a4c9c621ad..72ad94f295 100644 --- a/src/test/java/core/basesyntax/service/impl/ReportServiceImplTest.java +++ b/src/test/java/core/basesyntax/service/impl/ReportServiceImplTest.java @@ -15,6 +15,7 @@ class ReportServiceImplTest { @BeforeEach void setUp() { reportService = new ReportServiceImpl(); + Storage.storage.clear(); } @AfterEach diff --git a/src/test/java/core/basesyntax/validation/impl/OutputValidatorImplTest.java b/src/test/java/core/basesyntax/validation/impl/OutputValidatorImplTest.java index 0b1a330b49..f14babba7b 100644 --- a/src/test/java/core/basesyntax/validation/impl/OutputValidatorImplTest.java +++ b/src/test/java/core/basesyntax/validation/impl/OutputValidatorImplTest.java @@ -13,7 +13,6 @@ static void setUp() { outputValidator = new OutputValidatorImpl(); } - @Test void validFileValidation_Ok() { String validFileForTest = "src/test/java/resources/OutputValidatorValidTest.csv"; @@ -37,7 +36,7 @@ void invalidQuantity_NotOk() { @Test void noDataInFile_NotOk() { - String noDataFile = "src/test/java/resources/NullFile.csv"; + String noDataFile = "src/test/java/resources/NullFile.csv"; Assert.assertThrows(RuntimeException.class, () -> outputValidator.validateFile(noDataFile)); }