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

made tests for implementations and added files #784

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

Conversation

vsych321
Copy link

No description provided.

Copy link

@Parashchuk Parashchuk left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@liliia-ponomarenko liliia-ponomarenko 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! Let’s fix a few mistakes ;)

@@ -0,0 +1,28 @@
package model;

Choose a reason for hiding this comment

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

Why is the model package placed here?

import org.junit.jupiter.api.Test;

class FileWriterServiceImplTest {

Choose a reason for hiding this comment

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

Suggested change

assertThrows(RuntimeException.class, () -> fruitService.processFruitLines(data));
}

@Test

Choose a reason for hiding this comment

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

which difference between this test and input_InvalidData_NotOk

ActivityType.PURCHASE, new PurchaseOperationsHandler(),
ActivityType.RETURN, new ReturnOperationsHandler()
));

Choose a reason for hiding this comment

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

Suggested change

new FruitTransaction(ActivityType.BALANCE, "apple", 100),
new FruitTransaction(ActivityType.SUPPLY, "banana", 100)
);
assertDoesNotThrow(() -> processService.process(data));

Choose a reason for hiding this comment

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

you should check data in storage and add more test cases, for instance, purchase when fruits are not enough, other operations, etc.

Choose a reason for hiding this comment

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

not fixed

Copy link
Author

Choose a reason for hiding this comment

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

I added 4 more tests for that

Comment on lines 38 to 42
Storage.getStorage().put("banana", 100);
Storage.getStorage().put("apple", 100);
String expected = "fruit,quantity" + System.lineSeparator()
+ "banana,100" + System.lineSeparator()
+ "apple,100";

Choose a reason for hiding this comment

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

what are you testing here?

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

class FileWriterServiceImplTest {

Choose a reason for hiding this comment

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

you also can add a method that reads the file and checks the data that was written.

Choose a reason for hiding this comment

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

Not fixed

Copy link

@Elena-Bruyako Elena-Bruyako left a comment

Choose a reason for hiding this comment

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

Some comments should be fixed

new FruitTransaction(ActivityType.BALANCE, "apple", 100),
new FruitTransaction(ActivityType.SUPPLY, "banana", 100)
);
assertDoesNotThrow(() -> processService.process(data));

Choose a reason for hiding this comment

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

not fixed

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

class FileWriterServiceImplTest {

Choose a reason for hiding this comment

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

Not fixed

@vsych321 vsych321 requested a review from Elena-Bruyako October 1, 2023 13:43
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.

5 participants