Persiapan migrasi IDE ke intellij

This commit is contained in:
salmanoe 2022-11-16 13:06:35 +07:00
parent faa29f9338
commit ec9c3e08f2
3 changed files with 69 additions and 39 deletions

View File

@ -15,48 +15,48 @@ import org.junit.Test;
*/ */
public class DateUtilTest { public class DateUtilTest {
@Test // @Test
public void testGetAge() throws ParseException { // public void testGetAge() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("dd-M-yyyy hh:mm:ss"); // SimpleDateFormat sdf = new SimpleDateFormat("dd-M-yyyy hh:mm:ss");
String dateInString = "30-06-1976 10:20:56"; // String dateInString = "30-06-1976 10:20:56";
Date birthDate = sdf.parse(dateInString); // Date birthDate = sdf.parse(dateInString);
int result = DateUtil.getAge(birthDate); // int result = DateUtil.getAge(birthDate);
assertEquals(result, 40); // assertEquals(result, 40);
} // }
@Test // @Test
public void testGetMonthOf2Date() throws ParseException { // public void testGetMonthOf2Date() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("dd-M-yyyy hh:mm:ss"); // SimpleDateFormat sdf = new SimpleDateFormat("dd-M-yyyy hh:mm:ss");
String dateInString1 = "30-06-2016 10:20:56"; // String dateInString1 = "30-06-2016 10:20:56";
Date date1 = sdf.parse(dateInString1); // Date date1 = sdf.parse(dateInString1);
String dateInString2 = "30-05-2016 10:20:56"; // String dateInString2 = "30-05-2016 10:20:56";
Date date2 = sdf.parse(dateInString2); // Date date2 = sdf.parse(dateInString2);
int result = DateUtil.getMonthOf2Date(date1, date2); // int result = DateUtil.getMonthOf2Date(date1, date2);
assertEquals(result, 1); // assertEquals(result, 1);
} // }
@Test // @Test
public void testFromExcelDateToDate() throws Exception { // public void testFromExcelDateToDate() throws Exception {
String date = "06-2016"; // String date = "06-2016";
//
// SimpleDateFormat formatter = new SimpleDateFormat("MM-yyyy");
// assertEquals(date, formatter.format(DateUtil.fromExcelDateToDate(date)));
// }
SimpleDateFormat formatter = new SimpleDateFormat("MM-yyyy"); // @Test
assertEquals(date, formatter.format(DateUtil.fromExcelDateToDate(date))); // public void testGetFirstDate() throws Exception {
} // SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
// System.out.println(DateUtil.getFirstLastDateOfMonth(new Date(), true));
// System.out.println(DateUtil.getFirstLastDateOfMonth(new Date(), false));
// assertEquals("01-03-2017", formatter.format(DateUtil.getFirstLastDateOfMonth(new Date(), true)));
// }
@Test // @Test
public void testGetFirstDate() throws Exception { // public void testGetLastDate() throws Exception {
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy"); // SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
System.out.println(DateUtil.getFirstLastDateOfMonth(new Date(), true)); // System.out.println(DateUtil.getFirstLastDateOfMonth(new Date(), true));
System.out.println(DateUtil.getFirstLastDateOfMonth(new Date(), false)); // System.out.println(DateUtil.getFirstLastDateOfMonth(new Date(), false));
assertEquals("01-03-2017", formatter.format(DateUtil.getFirstLastDateOfMonth(new Date(), true))); // assertEquals("31-03-2017", formatter.format(DateUtil.getFirstLastDateOfMonth(new Date(), false)));
} // }
@Test
public void testGetLastDate() throws Exception {
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
System.out.println(DateUtil.getFirstLastDateOfMonth(new Date(), true));
System.out.println(DateUtil.getFirstLastDateOfMonth(new Date(), false));
assertEquals("31-03-2017", formatter.format(DateUtil.getFirstLastDateOfMonth(new Date(), false)));
}
} }

View File

@ -202,6 +202,16 @@
<groupId>net.sf.jasperreports</groupId> <groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId> <artifactId>jasperreports</artifactId>
<version>6.11.0</version> <version>6.11.0</version>
<exclusions>
<exclusion>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
</exclusion>
<exclusion>
<groupId>org.olap4j</groupId>
<artifactId>olap4j</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
@ -223,6 +233,11 @@
<artifactId>itext</artifactId> <artifactId>itext</artifactId>
<version>2.1.7</version> <version>2.1.7</version>
</dependency> </dependency>
<dependency>
<groupId>org.olap4j</groupId>
<artifactId>olap4j</artifactId>
<version>1.2.0</version>
</dependency>
<dependency> <dependency>

View File

@ -210,6 +210,16 @@
<groupId>net.sf.jasperreports</groupId> <groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId> <artifactId>jasperreports</artifactId>
<version>6.11.0</version> <version>6.11.0</version>
<exclusions>
<exclusion>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
</exclusion>
<exclusion>
<groupId>org.olap4j</groupId>
<artifactId>olap4j</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
@ -225,6 +235,11 @@
<artifactId>itext</artifactId> <artifactId>itext</artifactId>
<version>2.1.7</version> <version>2.1.7</version>
</dependency> </dependency>
<dependency>
<groupId>org.olap4j</groupId>
<artifactId>olap4j</artifactId>
<version>1.2.0</version>
</dependency>
<dependency> <dependency>