package de.interseroh.report.formatters;

import java.sql.Date;
import java.util.Locale;

import org.junit.Test;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

/**
 * @author Ingo Düppe (Crowdcode)
 */
public class DateFormatterTest {

	private static final Date testDate = new Date(2015, 12, 13);

    private static final DateFormatter formatter = new DateFormatter();

	@Test
	public void testParse() throws Exception {
		Date date = formatter.parse("12/13/15", Locale.US);
		assertThat(date, is(testDate));
	}

	@Test
	public void testPrint() throws Exception {
        String print = formatter.print(testDate, Locale.US);
		assertThat(print, is("12/13/15"));
    }

    @Test
    public void testParseGermanDate() throws Exception {
        Date date = formatter.parse("13.12.2015", Locale.GERMAN);
        assertThat(date, is(testDate));
    }

    @Test
    public void testPrintGermanDate() throws Exception {
        String print = formatter.print(testDate, Locale.GERMAN);
        assertThat(print, is("13.12.15"));

    }
}
@@ -317,20 +317,22 @@
 ate(
-2015, 12, 13
+1488063600000L
 );%0A%0A
@@ -486,24 +486,24 @@
 .parse(%22
-12/13/15
+02/26/17
 %22, Local
@@ -687,25 +687,21 @@
 is(%22
-1
 2/
-13/15
+26/17
 %22));%0A
-    
+%09
 %7D%0A%0A 
@@ -766,24 +766,18 @@
 ption %7B%0A
-        
+%09%09
 Date dat
@@ -801,18 +801,18 @@
 se(%22
-13.1
+26.0
 2.201
-5
+7
 %22, L
@@ -822,32 +822,26 @@
 le.GERMAN);%0A
-        
+%09%09
 assertThat(d
@@ -999,24 +999,18 @@
 ERMAN);%0A
-        
+%09%09
 assertTh
@@ -1027,16 +1027,16 @@
 is(%22
-13.12.15
+26.02.17
 %22));

fix test