1 package org.apache.maven.starteamlib;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import java.io.FileInputStream;
22 import java.util.Collection;
23 import java.util.Iterator;
24 import junit.framework.TestCase;
25
26 import org.apache.maven.changelog.ChangeLogEntry;
27
28
29 /**
30 * Test cases for {@link StarteamChangeLogParser}
31 * @author <a href="mailto:evenisse@ifrance.com">Emmanuel Venisse</a>
32 * @version $Id: StarteamChangeLogParser2Test.java 532339 2007-04-25 12:28:56Z ltheussl $
33 */
34 public class StarteamChangeLogParser2Test extends TestCase
35 {
36
37 /** the {@link StarteamChangeLogParser} used for testing */
38 private StarteamChangeLogParser instance;
39 /** file with test results to check against */
40 private String testFile;
41
42 /**
43 * Create a test with the given name
44 * @param testName the name of the test
45 */
46 public StarteamChangeLogParser2Test(String testName)
47 {
48 super(testName);
49 }
50
51 /**
52 * Initialize per test data
53 * @throws Exception when there is an unexpected problem
54 */
55 public void setUp() throws Exception
56 {
57 String baseDir = System.getProperty("basedir");
58 assertNotNull("The system property basedir was not defined.", baseDir);
59 testFile = baseDir + "/src/test-resources/starteamlib/starteamlog2.txt";
60 instance = new StarteamChangeLogParser();
61 }
62
63 /**
64 * Test of parse method
65 * @throws Exception when there is an unexpected problem
66 */
67 public void testParse() throws Exception
68 {
69 FileInputStream fis = new FileInputStream(testFile);
70 instance.setDateFormatInFile("yy-MM-dd HH:mm");
71 Collection entries = instance.parse(fis);
72 assertEquals("Wrong number of entries returned", 3, entries.size());
73 ChangeLogEntry entry = null;
74 for (Iterator i = entries.iterator(); i.hasNext(); )
75 {
76 entry = (ChangeLogEntry) i.next();
77 assertTrue("ChangeLogEntry erroneously picked up",
78 entry.toString().indexOf("ChangeLogEntry.java") == -1);
79 }
80
81 }
82
83 }