-
Notifications
You must be signed in to change notification settings - Fork 701
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
Logging and testing #38
base: master
Are you sure you want to change the base?
Logging and testing #38
Conversation
throw new IllegalArgumentException("Horses cannot be empty."); | ||
} | ||
|
||
this.horses = horses; | ||
LOGGER.debug("створення Hippodrome, коней [" + horses.size() + "]"); |
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.
don't commit logs with debug level, also this message is not informative, delete this log
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.
throw new IllegalArgumentException("Distance cannot be negative."); | ||
} | ||
|
||
this.name = name; | ||
this.speed = speed; | ||
this.distance = distance; | ||
|
||
LOGGER.debug("створення Horse, ім'я [" + name + "], " + "швидкість [" + speed + "]"); |
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.
don't commit logs with debug level, also this message is not informative, delete this log
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.
@@ -15,6 +20,8 @@ public static void main(String[] args) throws Exception { | |||
); | |||
Hippodrome hippodrome = new Hippodrome(horses); | |||
|
|||
LOGGER.info("Початок стрибків. Кількість учасників " + horses.size()); |
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.
don't commit logs with debug level, also this message is not informative, delete this log
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.
@@ -23,6 +30,8 @@ public static void main(String[] args) throws Exception { | |||
|
|||
String winnerName = hippodrome.getWinner().getName(); | |||
System.out.println(winnerName + " wins!"); | |||
|
|||
LOGGER.info("Закінчення стрибків. Переможець: " + winnerName); |
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.
don't commit logs with debug level, also this message is not informative, delete this log
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.
src/main/java/Main.java
Outdated
@@ -23,6 +30,8 @@ public static void main(String[] args) throws Exception { | |||
|
|||
String winnerName = hippodrome.getWinner().getName(); | |||
System.out.println(winnerName + " wins!"); |
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.
don't use System.out.println, if u need print some info, use LOG.info()
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.
don't use System.out.println, if u need print some info, use LOG.info()
Ok, but i`m fork this code, It's not my job
src/test/java/HippodromeTest.java
Outdated
import static org.mockito.Mockito.verify; | ||
|
||
public class HippodromeTest { | ||
private final List<Horse> horses = new ArrayList<>(Arrays.asList( |
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.
why do u create list in this style new ArrayList<List.of()) just us List.of it will return list of Hourses, or u can make it simplier, create a method private List prepareHourses() {
List hourses = new ArrayList();
for(int i = 0; i<30; i++) {
hourses.add(new Hourse("hourse" + i; 10,100);
}
return hourses;
}
} | ||
|
||
@Test | ||
void getNameTest() { |
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 a sense of this test?
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.
@Disabled | ||
@Test | ||
@Timeout(value = 22) | ||
void testMainForTimeout() { |
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 a sense of test?
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.
No description provided.