-
Notifications
You must be signed in to change notification settings - Fork 1k
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
base: main
Are you sure you want to change the base?
done the task #823
Conversation
There was a problem hiding this 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.
src/test/java/db/StorageTest.java
Outdated
} | ||
|
||
@Test | ||
public void putFruitToStorage_NullFruit_notOk() { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this 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
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); | ||
} |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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
There was a problem hiding this 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done.
No description provided.