-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLocalDateTest.java
More file actions
40 lines (30 loc) · 1.22 KB
/
LocalDateTest.java
File metadata and controls
40 lines (30 loc) · 1.22 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
37
38
39
40
package java8.time;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import java.time.LocalDate;
public class LocalDateTest {
private static final LocalDate nowDate = LocalDate.now();
@BeforeClass
public static void beforeClass() {
System.out.println("Now : " + nowDate);
System.out.println("Min : " + LocalDate.MIN);
System.out.println("Max : " + LocalDate.MAX);
System.out.println();
System.out.println("Day of Month : " + nowDate.getDayOfMonth());
System.out.println("Day of Year : " + nowDate.getDayOfYear());
System.out.println("Day of Week : " + nowDate.getDayOfWeek());
System.out.println();
System.out.println("Month Value : " + nowDate.getMonth());
System.out.println("Month : " + nowDate.getMonthValue());
System.out.println("Year : " + nowDate.getYear());
System.out.println();
System.out.println("1992-10-10 : " + LocalDate.of(1992, 10, 10));
System.out.println("Before 1 Day : " + nowDate.minusDays(1));
System.out.println("After 1 Day : " + nowDate.plusDays(1));
}
@Test
public void test() {
Assert.assertEquals(nowDate.getYear(), 2019);
}
}