1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package net.sf.statcvs.util;
24
25 import junit.framework.TestCase;
26
27 /**
28 * Test cases for {link net.sf.statcvs.util.CvsLogUtils}
29 *
30 * @author Richard Cyganiak
31 * @version $Id: CvsLogUtilsTest.java,v 1.4 2008/04/02 11:22:15 benoitx Exp $
32 */
33 public class CvsLogUtilsTest extends TestCase {
34
35 /**
36 * Constructor
37 * @param arg0 input
38 */
39 public CvsLogUtilsTest(final String arg0) {
40 super(arg0);
41 }
42
43 /**
44 * Tests {@link CvsLogUtil#isInAttic}
45 */
46 public void testIsInAttic() {
47 assertTrue(!CvsLogUtils.isInAttic("/cvsroot/module/file,v", "file"));
48 assertTrue(CvsLogUtils.isInAttic("/cvsroot/module/Attic/file,v", "file"));
49 assertTrue(!CvsLogUtils.isInAttic("/cvsroot/module/path/file,v", "path/file"));
50 assertTrue(CvsLogUtils.isInAttic("/cvsroot/module/path/Attic/file,v", "path/file"));
51 assertTrue(!CvsLogUtils.isInAttic("/cvsroot/module/attic/file,v", "attic/file"));
52 }
53
54 /**
55 * test {@link CvsLogUtil#isOnMainBranch(String)}
56 */
57 public void testMainBranchRevisions() {
58 assertTrue(CvsLogUtils.isOnMainBranch("1.1"));
59 assertTrue(CvsLogUtils.isOnMainBranch("5.12"));
60 assertTrue(!CvsLogUtils.isOnMainBranch("1.1.1.1"));
61 assertTrue(!CvsLogUtils.isOnMainBranch("5.12.2.4"));
62 assertTrue(!CvsLogUtils.isOnMainBranch("5.12.2.4.4.11"));
63 }
64
65 /**
66 * Test {@link CvsLogUtil#getModuleName}
67 */
68 public void testGetModuleName() {
69 assertEquals("cvsroot", CvsLogUtils.getModuleName("/cvsroot/module/file,v", "module/file"));
70 assertEquals("cvsroot", CvsLogUtils.getModuleName("/cvsroot/module/Attic/file,v", "module/file"));
71 assertEquals("module", CvsLogUtils.getModuleName("/cvsroot/module/file,v", "file"));
72 assertEquals("module", CvsLogUtils.getModuleName("/cvsroot/module/Attic/file,v", "file"));
73 assertEquals("", CvsLogUtils.getModuleName("/file,v", "file"));
74 }
75 }