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

done the task #823

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Alexander1iubchenko
Copy link

No description provided.

Copy link

@bhdnchui bhdnchui left a comment

Choose a reason for hiding this comment

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

Pretty good gob! But please, add tests for operations.

}

@Test
public void putFruitToStorage_NullFruit_notOk() {

Choose a reason for hiding this comment

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

Use lower case letter after _.
Make sure use it everywhere.

private final List<String> lines = new ArrayList<>();
private final Writer reportWrite = new WriterImpl();

@BeforeEach

Choose a reason for hiding this comment

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

think about making it before all.

Copy link

@kshuryhin kshuryhin left a comment

Choose a reason for hiding this comment

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

Good job, some minor points to consider. Also, please, remove text file out of the java.res folder

Comment on lines 56 to 81
public void testValidDailyReportProcessing() {
fruitTransactionService.makeReport(transactionList);
assertEquals(EXPECTED_RESULT, (long) Storage.getFruitsNumber(APPLE));
}

@Test
public void testNegativeAmountInTransaction() {
final List<FruitTransaction> originalList = new ArrayList<>(transactionList);
transactionList.clear();
transactionList.add(new FruitTransaction(FruitTransaction
.Operation.BALANCE, APPLE, AMOUNT));
transactionList.add(new FruitTransaction(FruitTransaction
.Operation.PURCHASE, APPLE, AMOUNT + PLUS_INDEX));
assertNotEquals(originalList, transactionList);
}

@Test
public void testZeroAmountInTransaction() {
final List<FruitTransaction> originalList = new ArrayList<>(transactionList);
transactionList.clear();
transactionList.add(new FruitTransaction(FruitTransaction
.Operation.BALANCE, APPLE, AMOUNT));
transactionList.add(new FruitTransaction(FruitTransaction
.Operation.PURCHASE, APPLE, 0));
assertNotEquals(originalList, transactionList);
}

Choose a reason for hiding this comment

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

Please, follow the method's naming you've chosen to make code more consistent

}

@Test
public void testDoOperation_AddsTransactionQuantityToStorage() {

Choose a reason for hiding this comment

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

Minor, but I believe test prefix in method names is not needed here and in other operation tests

Copy link

@kshuryhin kshuryhin left a comment

Choose a reason for hiding this comment

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

Fails on the CI

Copy link

@d1sam d1sam left a comment

Choose a reason for hiding this comment

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

Well done.

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.

4 participants