-
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
add solution1 #799
base: main
Are you sure you want to change the base?
add solution1 #799
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 solution, but you can improve it a little bit
@@ -0,0 +1,4 @@ | |||
package core.basesyntax; | |||
|
|||
class MainTest { |
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.
Redundant class
private ReaderService fileReaderService = new FileReaderServiceImpl(); | ||
|
||
@Test | ||
void readFromNonExistingDirectory_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.
In method name there is not the name of method
} | ||
|
||
@Test | ||
void readFromExistingDirectory_Ok() { |
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.
the same
import org.junit.jupiter.api.Test; | ||
|
||
public class ReportCreatorServiceImplTest { | ||
private static ReportCreatorService reportCreatorService; |
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.
I think you can add keyword final here
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.
Very Good Job! Lets improve your solution
@Test | ||
void convertData_notNumericQuantity_notOk() { | ||
List<String> data = List.of("b,banana,10", "b,apple,10", "s,banana,2a0"); | ||
assertThrows(RuntimeException.class, |
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.
where in your code u throw RuntimeException?
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.
not fixed
import org.junit.jupiter.api.Test; | ||
|
||
public class BalanceOperationTest { | ||
private final OperationService balanceOperation = new BalanceOperation(); |
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.
lets initializate it in BeforeAll. Same in other cases
balanceOperation.doOperation(appleTransaction); | ||
int secondAppleActual = Storage.getStorage().get("apple"); | ||
assertEquals(120, secondAppleActual); | ||
} |
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 you send a negative value or null here. Same in other cases
@Test | ||
void convertData_notNumericQuantity_notOk() { | ||
List<String> data = List.of("b,banana,10", "b,apple,10", "s,banana,2a0"); | ||
assertThrows(RuntimeException.class, |
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.
not fixed
No description provided.