-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLocalTimeTest.java
More file actions
36 lines (27 loc) · 1.03 KB
/
LocalTimeTest.java
File metadata and controls
36 lines (27 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package java8.time;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import java.time.LocalTime;
public class LocalTimeTest {
private static final LocalTime nowTime = LocalTime.now();
@BeforeClass
public static void beforeClass() {
System.out.println("Now : " + nowTime);
System.out.println("Min : " + LocalTime.MIN);
System.out.println("Max : " + LocalTime.MAX);
System.out.println("Noon : " + LocalTime.NOON);
System.out.println("Mid Night : " + LocalTime.MIDNIGHT);
System.out.println();
System.out.println("Now Hour : " + nowTime.getHour());
System.out.println("Now Minute : " + nowTime.getMinute());
System.out.println("Now Second : " + nowTime.getSecond());
System.out.println();
System.out.println("20:00 : " + LocalTime.of(20, 0, 0));
System.out.println("After 1 Hours : " + nowTime.plusHours(1));
}
@Test
public void test() {
Assert.assertEquals(nowTime.getHour(), 10);
}
}