// must use *Linked* HashMap to have predictable toString
final Map<ScmFileStatus, AtomicInteger> summary = new LinkedHashMap<ScmFileStatus, AtomicInteger>();
for ( Iterator<ChangeSet> i = modifications.iterator(); i.hasNext(); )
{
ChangeSet entry = i.next();
assertEquals( "Mark Struberg <struberg@yahoo.de>", entry.getAuthor() );
assertNotNull( entry.getDate() );
assertTrue( entry.getComment() != null && entry.getComment().length() > 0 );
assertNotNull( entry.getRevision() );
assertNotNull( entry.getFiles() );
assertFalse( entry.getFiles().isEmpty() );
for ( ChangeFile file : entry.getFiles() )
{
final ScmFileStatus action = file.getAction();
if ( !summary.containsKey( action ) )
{
summary.put( action, new AtomicInteger() );
}
summary.get( action ).incrementAndGet();
}
}
Assert.assertEquals( "Action summary differs from expectations", "{modified=21, added=88, deleted=1}",
summary.toString() );
assertEquals( 8, modifications.size() );
ChangeSet entry = modifications.get( 4 );
assertEquals( "Mark Struberg <struberg@yahoo.de>", entry.getAuthor() );
assertNotNull( entry.getDate() );
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss Z" );
sdf.setTimeZone( TimeZone.getTimeZone( "GMT" ) );
assertEquals( "2007-11-27 13:05:36 +0000", sdf.format( entry.getDate() ) );
assertEquals( "52733aa427041cafd760833cb068ffe897fd35db", entry.getRevision() );
assertEquals( "fixed a GitCommandLineUtil and provice first version of the checkin command.",
entry.getComment() );
assertNotNull( entry.getFiles() );
assertEquals( 10, entry.getFiles().size() );
ChangeFile cf = entry.getFiles().get( 0 );
assertEquals(
"maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/GitCommandLineUtils.java",
cf.getName() );
assertTrue( cf.getRevision() != null && cf.getRevision().length() > 0 );
}