@ -72,7 +72,8 @@ public class GitDateParserTest {
GregorianCalendar cal = new GregorianCalendar ( SystemReader
GregorianCalendar cal = new GregorianCalendar ( SystemReader
. getInstance ( ) . getTimeZone ( ) , SystemReader . getInstance ( )
. getInstance ( ) . getTimeZone ( ) , SystemReader . getInstance ( )
. getLocale ( ) ) ;
. getLocale ( ) ) ;
Date parse = GitDateParser . parse ( "yesterday" , cal ) ;
Date parse = GitDateParser . parse ( "yesterday" , cal , SystemReader
. getInstance ( ) . getLocale ( ) ) ;
cal . add ( Calendar . DATE , - 1 ) ;
cal . add ( Calendar . DATE , - 1 ) ;
cal . set ( Calendar . HOUR_OF_DAY , 0 ) ;
cal . set ( Calendar . HOUR_OF_DAY , 0 ) ;
cal . set ( Calendar . MINUTE , 0 ) ;
cal . set ( Calendar . MINUTE , 0 ) ;
@ -87,7 +88,8 @@ public class GitDateParserTest {
GregorianCalendar cal = new GregorianCalendar ( SystemReader
GregorianCalendar cal = new GregorianCalendar ( SystemReader
. getInstance ( ) . getTimeZone ( ) , SystemReader . getInstance ( )
. getInstance ( ) . getTimeZone ( ) , SystemReader . getInstance ( )
. getLocale ( ) ) ;
. getLocale ( ) ) ;
Date parse = GitDateParser . parse ( "never" , cal ) ;
Date parse = GitDateParser . parse ( "never" , cal , SystemReader
. getInstance ( ) . getLocale ( ) ) ;
Assert . assertEquals ( GitDateParser . NEVER , parse ) ;
Assert . assertEquals ( GitDateParser . NEVER , parse ) ;
parse = GitDateParser . parse ( "never" , null ) ;
parse = GitDateParser . parse ( "never" , null ) ;
Assert . assertEquals ( GitDateParser . NEVER , parse ) ;
Assert . assertEquals ( GitDateParser . NEVER , parse ) ;
@ -104,7 +106,8 @@ public class GitDateParserTest {
. getLocale ( ) ) ;
. getLocale ( ) ) ;
cal . setTime ( refDate ) ;
cal . setTime ( refDate ) ;
Date parse = GitDateParser . parse ( "now" , cal ) ;
Date parse = GitDateParser . parse ( "now" , cal , SystemReader . getInstance ( )
. getLocale ( ) ) ;
Assert . assertEquals ( refDate , parse ) ;
Assert . assertEquals ( refDate , parse ) ;
long t1 = SystemReader . getInstance ( ) . getCurrentTime ( ) ;
long t1 = SystemReader . getInstance ( ) . getCurrentTime ( ) ;
parse = GitDateParser . parse ( "now" , null ) ;
parse = GitDateParser . parse ( "now" , null ) ;
@ -123,7 +126,8 @@ public class GitDateParserTest {
. getLocale ( ) ) ;
. getLocale ( ) ) ;
cal . setTime ( refDate ) ;
cal . setTime ( refDate ) ;
Date parse = GitDateParser . parse ( "2 weeks ago" , cal ) ;
Date parse = GitDateParser . parse ( "2 weeks ago" , cal , SystemReader
. getInstance ( ) . getLocale ( ) ) ;
Assert . assertEquals ( df . parse ( "2007-02-07 15:35:00 +0100" ) , parse ) ;
Assert . assertEquals ( df . parse ( "2007-02-07 15:35:00 +0100" ) , parse ) ;
}
}
@ -138,7 +142,8 @@ public class GitDateParserTest {
. getLocale ( ) ) ;
. getLocale ( ) ) ;
cal . setTime ( refDate ) ;
cal . setTime ( refDate ) ;
Date parse = GitDateParser . parse ( "2 weeks ago" , cal ) ;
Date parse = GitDateParser . parse ( "2 weeks ago" , cal , SystemReader . getInstance ( )
. getLocale ( ) ) ;
Assert . assertEquals ( df . parse ( "2007-02-07 15:35:00 +0100" ) , parse ) ;
Assert . assertEquals ( df . parse ( "2007-02-07 15:35:00 +0100" ) , parse ) ;
parse = GitDateParser . parse ( "3 days 2 weeks ago" , cal ) ;
parse = GitDateParser . parse ( "3 days 2 weeks ago" , cal ) ;
Assert . assertEquals ( df . parse ( "2007-02-04 15:35:00 +0100" ) , parse ) ;
Assert . assertEquals ( df . parse ( "2007-02-04 15:35:00 +0100" ) , parse ) ;
@ -151,7 +156,8 @@ public class GitDateParserTest {
String dateStr = "2007-02-21 15:35:00 +0100" ;
String dateStr = "2007-02-21 15:35:00 +0100" ;
Date exp = SystemReader . getInstance ( )
Date exp = SystemReader . getInstance ( )
. getSimpleDateFormat ( "yyyy-MM-dd HH:mm:ss Z" ) . parse ( dateStr ) ;
. getSimpleDateFormat ( "yyyy-MM-dd HH:mm:ss Z" ) . parse ( dateStr ) ;
Date parse = GitDateParser . parse ( dateStr , null ) ;
Date parse = GitDateParser . parse ( dateStr , null , SystemReader
. getInstance ( ) . getLocale ( ) ) ;
Assert . assertEquals ( exp , parse ) ;
Assert . assertEquals ( exp , parse ) ;
}
}
@ -161,7 +167,8 @@ public class GitDateParserTest {
Date exp = SystemReader . getInstance ( )
Date exp = SystemReader . getInstance ( )
. getSimpleDateFormat ( "EEE, dd MMM yyyy HH:mm:ss Z" )
. getSimpleDateFormat ( "EEE, dd MMM yyyy HH:mm:ss Z" )
. parse ( dateStr ) ;
. parse ( dateStr ) ;
Date parse = GitDateParser . parse ( dateStr , null ) ;
Date parse = GitDateParser . parse ( dateStr , null , SystemReader
. getInstance ( ) . getLocale ( ) ) ;
Assert . assertEquals ( exp , parse ) ;
Assert . assertEquals ( exp , parse ) ;
}
}
@ -170,7 +177,8 @@ public class GitDateParserTest {
String dateStr = "2007-02-21" ;
String dateStr = "2007-02-21" ;
Date exp = SystemReader . getInstance ( ) . getSimpleDateFormat ( "yyyy-MM-dd" )
Date exp = SystemReader . getInstance ( ) . getSimpleDateFormat ( "yyyy-MM-dd" )
. parse ( dateStr ) ;
. parse ( dateStr ) ;
Date parse = GitDateParser . parse ( dateStr , null ) ;
Date parse = GitDateParser . parse ( dateStr , null , SystemReader
. getInstance ( ) . getLocale ( ) ) ;
Assert . assertEquals ( exp , parse ) ;
Assert . assertEquals ( exp , parse ) ;
}
}
@ -179,7 +187,8 @@ public class GitDateParserTest {
String dateStr = "2007.02.21" ;
String dateStr = "2007.02.21" ;
Date exp = SystemReader . getInstance ( ) . getSimpleDateFormat ( "yyyy.MM.dd" )
Date exp = SystemReader . getInstance ( ) . getSimpleDateFormat ( "yyyy.MM.dd" )
. parse ( dateStr ) ;
. parse ( dateStr ) ;
Date parse = GitDateParser . parse ( dateStr , null ) ;
Date parse = GitDateParser . parse ( dateStr , null , SystemReader
. getInstance ( ) . getLocale ( ) ) ;
Assert . assertEquals ( exp , parse ) ;
Assert . assertEquals ( exp , parse ) ;
}
}
@ -188,7 +197,8 @@ public class GitDateParserTest {
String dateStr = "02/21/2007" ;
String dateStr = "02/21/2007" ;
Date exp = SystemReader . getInstance ( ) . getSimpleDateFormat ( "MM/dd/yyyy" )
Date exp = SystemReader . getInstance ( ) . getSimpleDateFormat ( "MM/dd/yyyy" )
. parse ( dateStr ) ;
. parse ( dateStr ) ;
Date parse = GitDateParser . parse ( dateStr , null ) ;
Date parse = GitDateParser . parse ( dateStr , null , SystemReader
. getInstance ( ) . getLocale ( ) ) ;
Assert . assertEquals ( exp , parse ) ;
Assert . assertEquals ( exp , parse ) ;
}
}
@ -197,7 +207,8 @@ public class GitDateParserTest {
String dateStr = "21.02.2007" ;
String dateStr = "21.02.2007" ;
Date exp = SystemReader . getInstance ( ) . getSimpleDateFormat ( "dd.MM.yyyy" )
Date exp = SystemReader . getInstance ( ) . getSimpleDateFormat ( "dd.MM.yyyy" )
. parse ( dateStr ) ;
. parse ( dateStr ) ;
Date parse = GitDateParser . parse ( dateStr , null ) ;
Date parse = GitDateParser . parse ( dateStr , null , SystemReader
. getInstance ( ) . getLocale ( ) ) ;
Assert . assertEquals ( exp , parse ) ;
Assert . assertEquals ( exp , parse ) ;
}
}
@ -207,7 +218,8 @@ public class GitDateParserTest {
Date exp = SystemReader . getInstance ( )
Date exp = SystemReader . getInstance ( )
. getSimpleDateFormat ( "EEE MMM dd HH:mm:ss yyyy Z" )
. getSimpleDateFormat ( "EEE MMM dd HH:mm:ss yyyy Z" )
. parse ( dateStr ) ;
. parse ( dateStr ) ;
Date parse = GitDateParser . parse ( dateStr , null ) ;
Date parse = GitDateParser . parse ( dateStr , null , SystemReader
. getInstance ( ) . getLocale ( ) ) ;
Assert . assertEquals ( exp , parse ) ;
Assert . assertEquals ( exp , parse ) ;
}
}
@ -216,7 +228,8 @@ public class GitDateParserTest {
String dateStr = "Wed Feb 21 15:35:00 2007" ;
String dateStr = "Wed Feb 21 15:35:00 2007" ;
Date exp = SystemReader . getInstance ( )
Date exp = SystemReader . getInstance ( )
. getSimpleDateFormat ( "EEE MMM dd HH:mm:ss yyyy" ) . parse ( dateStr ) ;
. getSimpleDateFormat ( "EEE MMM dd HH:mm:ss yyyy" ) . parse ( dateStr ) ;
Date parse = GitDateParser . parse ( dateStr , null ) ;
Date parse = GitDateParser . parse ( dateStr , null , SystemReader
. getInstance ( ) . getLocale ( ) ) ;
Assert . assertEquals ( exp , parse ) ;
Assert . assertEquals ( exp , parse ) ;
}
}
}
}