Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My implementation of FruitShopTest. #796

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pastcwdt
Copy link

No description provided.

Copy link

@TetianaDenchyk TetianaDenchyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

private static final String PATH = "src/test/resources/transactions.csv";
private static final String WRONG_PATH = "src/test/resources/newTransactions.csv";
private static FileReaderService fileReaderService;
private static List<String> expectedList;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u can create and use it in test method

Comment on lines +16 to +18
private static final String EXPECTED_REPORT = "fruit,quantity" + System.lineSeparator()
+ "banana,110" + System.lineSeparator()
+ "apple,160" + System.lineSeparator();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same. Don't use constant. Better to create and use variables in test methods

import org.junit.jupiter.api.Test;

class OperationProcessTest {
private static final FruitDao fruitDao = new FruitDaoImpl();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u use it only in method beforeAll()

import org.junit.jupiter.api.Test;

class ReportServiceTest {
private static final String EXPECTED_RESULT = "fruit,quantity" + System.lineSeparator()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

reportService = new ReportServiceImpl();
}

@BeforeEach

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to use AfterEach

import org.junit.jupiter.api.Test;

class BalanceHandlerTest {
private static final FruitDao fruitDao = new FruitDaoImpl();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

class OperationHandlerStrategyTest {
private static OperationHandlerStrategy operationHandlerStrategy;
private static Map<FruitTransaction.Operation, OperationHandler> handlerMap = new HashMap<>();
private static OperationHandler expected;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Storage.STORAGE.put("banana", 100);
operationHandler.execute("banana", 40);
assertEquals(140, Storage.STORAGE.get("banana"));
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will happen if the data is negative?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants