-
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
My implementation of FruitShopTest. #796
base: main
Are you sure you want to change the base?
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.
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; |
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.
u can create and use it in test method
private static final String EXPECTED_REPORT = "fruit,quantity" + System.lineSeparator() | ||
+ "banana,110" + System.lineSeparator() | ||
+ "apple,160" + System.lineSeparator(); |
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.
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(); |
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.
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() |
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.
same
reportService = new ReportServiceImpl(); | ||
} | ||
|
||
@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.
better to use AfterEach
import org.junit.jupiter.api.Test; | ||
|
||
class BalanceHandlerTest { | ||
private static final FruitDao fruitDao = new FruitDaoImpl(); |
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.
same
class OperationHandlerStrategyTest { | ||
private static OperationHandlerStrategy operationHandlerStrategy; | ||
private static Map<FruitTransaction.Operation, OperationHandler> handlerMap = new HashMap<>(); | ||
private static OperationHandler expected; |
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.
same
Storage.STORAGE.put("banana", 100); | ||
operationHandler.execute("banana", 40); | ||
assertEquals(140, Storage.STORAGE.get("banana")); | ||
} |
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.
what will happen if the data is negative?
No description provided.