@@ -49,8 +49,8 @@ public class NativeAndJGitProviderTest extends GitIntegrationTest
4949 "git.remote.origin.url"
5050 };
5151
52- // Can't be static, not thread safe.
53- public final DateFormat DEFAULT_FORMAT = new SimpleDateFormat ( "dd.MM. yyyy '@' HH:mm:ss z" ) ;
52+ public static final String DEFAULT_FORMAT_STRING = "dd.MM.yyyy '@' HH:mm:ss z" ;
53+ public static final String ISO8601_FORMAT_STRING = " yyyy-MM-dd'T' HH:mm:ssZZ" ;
5454
5555 @ Test
5656 public void testCompareBasic () throws Exception
@@ -59,7 +59,7 @@ public void testCompareBasic() throws Exception
5959 for (AvailableGitTestRepo testRepo : AvailableGitTestRepo .values ()) {
6060 mavenSandbox .withParentProject ("my-basic-project" , "jar" ).withNoChildProject ().withGitRepoInParent (testRepo ).create (CleanUp .CLEANUP_FIRST );
6161 MavenProject targetProject = mavenSandbox .getParentProject ();
62- verifyNativeAndJGit (targetProject , DEFAULT_FORMAT );
62+ verifyNativeAndJGit (targetProject , DEFAULT_FORMAT_STRING );
6363 }
6464 }
6565
@@ -72,7 +72,7 @@ public void testCompareSubrepoInRoot() throws Exception
7272 }
7373 mavenSandbox .withParentProject ("my-pom-project" , "pom" ).withChildProject ("my-jar-module" , "jar" ).withGitRepoInParent (testRepo ).create (CleanUp .CLEANUP_FIRST );
7474 MavenProject targetProject = mavenSandbox .getParentProject ();
75- verifyNativeAndJGit (targetProject , DEFAULT_FORMAT );
75+ verifyNativeAndJGit (targetProject , DEFAULT_FORMAT_STRING );
7676 }
7777 }
7878
@@ -85,16 +85,31 @@ public void testCompareSubrepoInChild() throws Exception
8585 }
8686 mavenSandbox .withParentProject ("my-pom-project" , "pom" ).withChildProject ("my-jar-module" , "jar" ).withGitRepoInParent (testRepo ).create (CleanUp .CLEANUP_FIRST );
8787 MavenProject targetProject = mavenSandbox .getChildProject ();
88- verifyNativeAndJGit (targetProject , DEFAULT_FORMAT );
88+ verifyNativeAndJGit (targetProject , DEFAULT_FORMAT_STRING );
8989 }
9090 }
9191
92- private void verifyNativeAndJGit (MavenProject targetProject , DateFormat format ) throws Exception
92+ @ Test
93+ public void testCompareISO8601Time () throws Exception
94+ {
95+ // Test on all available basic repos to ensure that the output is identical.
96+ for (AvailableGitTestRepo testRepo : AvailableGitTestRepo .values ()) {
97+ mavenSandbox .withParentProject ("my-basic-project" , "jar" ).withNoChildProject ().withGitRepoInParent (testRepo ).create (CleanUp .CLEANUP_FIRST );
98+ MavenProject targetProject = mavenSandbox .getParentProject ();
99+ verifyNativeAndJGit (targetProject , ISO8601_FORMAT_STRING );
100+ }
101+ }
102+
103+ private void verifyNativeAndJGit (MavenProject targetProject , String formatString ) throws Exception
93104 {
94105 setProjectToExecuteMojoIn (targetProject );
95106
96- alterMojoSettings ("useNativeGit" , false );
97107 alterMojoSettings ("skipPoms" , false );
108+ alterMojoSettings ("dateFormat" , formatString );
109+
110+ DateFormat format = new SimpleDateFormat (formatString );
111+
112+ alterMojoSettings ("useNativeGit" , false );
98113 mojo .execute ();
99114 Properties jgitProps = createCopy (targetProject .getProperties ());
100115
0 commit comments