diff --git a/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java b/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java index 1f7f55e0..581260cf 100644 --- a/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java +++ b/changelog/src/test/org/apache/maven/svnlib/SvnChangeLogParserTest.java @@ -18,103 +18,106 @@ package org.apache.maven.svnlib; */ import java.io.FileInputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.List; import java.util.Locale; -import java.util.ArrayList; -import java.text.SimpleDateFormat; +import java.util.TimeZone; + import junit.framework.TestCase; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.maven.changelog.ChangeLogEntry; /** * Test cases for {@link SvnChangeLogParser}. - * + * * @author Pete Kazmier - * @version $Id$ + * @version $Id: SvnChangeLogParserTest.java 293395 2005-10-03 17:14:54Z + * ltheussl $ */ -public class SvnChangeLogParserTest extends TestCase -{ - /** Date formatter */ - private static final SimpleDateFormat DATE = - new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.US); +public class SvnChangeLogParserTest extends TestCase { - /** The {@link SvnChangeLogParser} used for testing */ - private SvnChangeLogParser parser; + private static final Log LOGGER = LogFactory + .getLog(SvnChangeLogParserTest.class); - /** File with test results to check against */ - private String testFile; + /** Date formatter */ + private static final SimpleDateFormat DATE = new SimpleDateFormat( + "EEE MMM dd HH:mm:ss z yyyy", Locale.US); - /** - * Create a test with the given name. - * - * @param testName the name of the test. - */ - public SvnChangeLogParserTest(String testName) - { - super(testName); - } + /** The {@link SvnChangeLogParser} used for testing */ + private SvnChangeLogParser parser; - /** - * Initialize per test data. - * - * @throws Exception when there is an unexpected problem. - */ - public void setUp() throws Exception - { - String baseDir = System.getProperty("basedir"); - assertNotNull("The system property basedir was not defined.", baseDir); - testFile = baseDir + "/src/test-resources/svnlib/svnlog.txt"; - parser = new SvnChangeLogParser(); - } + /** File with test results to check against */ + private String testFile; - /** - * Test the subversion parser. - * - * @throws Exception when there is an unexpected problem - */ - public void testParse() throws Exception - { - FileInputStream fis = new FileInputStream(testFile); - List entries = new ArrayList(parser.parse(fis)); + /** + * Create a test with the given name. + * + * @param testName + * the name of the test. + */ + public SvnChangeLogParserTest(String testName) { + super(testName); + } - assertEquals("Wrong number of entries returned", 14, entries.size()); + /** + * Initialize per test data. + * + * @throws Exception + * when there is an unexpected problem. + */ + public void setUp() throws Exception { + String baseDir = System.getProperty("basedir"); + assertNotNull("The system property basedir was not defined.", baseDir); + testFile = baseDir + "/src/test-resources/svnlib/svnlog.txt"; + parser = new SvnChangeLogParser(); + } - ChangeLogEntry entry = (ChangeLogEntry) entries.get(0); - assertEquals("Entry 0 was parsed incorrectly", - "kaz\n" + - DATE.parse("Mon Aug 26 20:33:26 EDT 2002") + "\n" + - "[/poolserver/trunk/build.xml, 16, " + - "/poolserver/trunk/project.properties, 16]\n" + - "Minor formatting changes.\n\n", - entry.toString()); - /* check author with space was parsed correctly */ - entry = (ChangeLogEntry) entries.get(1); - assertEquals("Entry 0 was parsed incorrectly", - "kaz toto",entry.getAuthor()); + /** + * Test the subversion parser. + * + * @throws Exception + * when there is an unexpected problem + */ + public void testParse() throws Exception { + FileInputStream fis = new FileInputStream(testFile); + List entries = new ArrayList(parser.parse(fis)); - entry = (ChangeLogEntry) entries.get(7); - assertEquals("Entry 6 was parsed incorrectly", - "(no author)\n" + - DATE.parse("Fri Aug 23 11:11:52 EDT 2002") + "\n" + - "[/poolserver/trunk/build.xml, 9]\n" + - "Testing script out again ...\n\n", - entry.toString()); + assertEquals("Wrong number of entries returned", 14, entries.size()); - entry = (ChangeLogEntry) entries.get(9); - assertEquals("Entry 8 was parsed incorrectly", - "pete\n" + - DATE.parse("Fri Aug 23 11:03:39 EDT 2002") + "\n" + - "[/poolserver/trunk/build.xml, 7]\n" + - "Reformatted the indentation (really just an excuse to test out\n" + - "subversion).\n\n", - entry.toString()); + ChangeLogEntry entry = (ChangeLogEntry) entries.get(0); + assertEquals("Entry 0 was parsed incorrectly", "kaz\n" + + DATE.parse("Mon Aug 26 20:33:26 -0400 2002") + "\n" + + "[/poolserver/trunk/build.xml, 16, " + + "/poolserver/trunk/project.properties, 16]\n" + + "Minor formatting changes.\n\n", entry.toString()); + /* check author with space was parsed correctly */ + entry = (ChangeLogEntry) entries.get(1); + assertEquals("Entry 0 was parsed incorrectly", "kaz toto", entry + .getAuthor()); - entry = (ChangeLogEntry) entries.get(13); - assertEquals("Entry 12 was parsed incorrectly", - "DOMAIN\\user\n" + - DATE.parse("Wed Aug 21 00:20:25 EDT 2002") + "\n" + - "[/poolserver/trunk/build.xml, 1]\n" + - "Cleaned up some whitespace.\n\n", - entry.toString()); - } + entry = (ChangeLogEntry) entries.get(7); + assertEquals("Entry 6 was parsed incorrectly", "(no author)\n" + + DATE.parse("Fri Aug 23 11:11:52 -0400 2002") + "\n" + + "[/poolserver/trunk/build.xml, 9]\n" + + "Testing script out again ...\n\n", entry.toString()); + + entry = (ChangeLogEntry) entries.get(9); + assertEquals( + "Entry 8 was parsed incorrectly", + "pete\n" + + DATE.parse("Fri Aug 23 11:03:39 -0400 2002") + + "\n" + + "[/poolserver/trunk/build.xml, 7]\n" + + "Reformatted the indentation (really just an excuse to test out\n" + + "subversion).\n\n", entry.toString()); + + entry = (ChangeLogEntry) entries.get(13); + assertEquals("Entry 12 was parsed incorrectly", "DOMAIN\\user\n" + + DATE.parse("Wed Aug 21 00:20:25 -0400 2002") + "\n" + + "[/poolserver/trunk/build.xml, 1]\n" + + "Cleaned up some whitespace.\n\n", entry.toString()); + } }