Fixed SimpleDateFormatUnitTest
This commit is contained in:
parent
f83798f80c
commit
8837a12608
@ -1,4 +1,4 @@
|
|||||||
package com.baeldung;
|
package com.baeldung.simpledateformat;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -32,6 +32,7 @@ public class SimpleDateFormatUnitTest {
|
|||||||
@Test
|
@Test
|
||||||
public void givenStringDate_whenParsed_thenCheckDateCorrect() throws Exception{
|
public void givenStringDate_whenParsed_thenCheckDateCorrect() throws Exception{
|
||||||
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
|
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
|
||||||
|
formatter.setTimeZone(TimeZone.getTimeZone("Europe/London"));
|
||||||
Date myDate = new Date(233276400000L);
|
Date myDate = new Date(233276400000L);
|
||||||
Date parsedDate = formatter.parse("24-05-1977");
|
Date parsedDate = formatter.parse("24-05-1977");
|
||||||
assertEquals(myDate.getTime(), parsedDate.getTime());
|
assertEquals(myDate.getTime(), parsedDate.getTime());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user