From bb6224d7712addbaeb15f2db5eaa80fec96aaf35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Soares?= Date: Sun, 5 Feb 2017 18:24:48 +0000 Subject: [PATCH] Make test pass in non-english computers where tests are run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tested failed in my portuguese language OS because of: Ter(ça) is Tue(sday) Movie [imdbId=tt0472043, director=null, actors=[ActorJackson [imdbId=nm2199632, dateOfBirth=Ter set 21 11:00:00 GMT 1982, filmography=[Apocalypto, Beatdown, Wind Walkers]]]] Movie [imdbId=tt0472043, director=null, actors=[ActorJackson [imdbId=nm2199632, dateOfBirth=Tue Sep 21 11:00:00 GMT 1982, filmography=[Apocalypto, Beatdown, Wind Walkers]]]] Locale was enforced --- .../main/java/com/baeldung/jackson/entities/ActorJackson.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jackson/src/main/java/com/baeldung/jackson/entities/ActorJackson.java b/jackson/src/main/java/com/baeldung/jackson/entities/ActorJackson.java index f6a8b0cf61..76f87d80b3 100644 --- a/jackson/src/main/java/com/baeldung/jackson/entities/ActorJackson.java +++ b/jackson/src/main/java/com/baeldung/jackson/entities/ActorJackson.java @@ -4,6 +4,7 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; +import java.util.Locale; import java.util.TimeZone; public class ActorJackson { @@ -53,7 +54,7 @@ public class ActorJackson { } private String formatDateOfBirth() { - final DateFormat formatter = new SimpleDateFormat("EEE MMM dd hh:mm:ss zzz yyyy"); + final DateFormat formatter = new SimpleDateFormat("EEE MMM dd hh:mm:ss zzz yyyy", Locale.US); formatter.setTimeZone(TimeZone.getTimeZone("GMT")); return formatter.format(dateOfBirth); }