Add test class for ScmUtil

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@376590 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ltheussl committed 2006-02-10 08:07:47 +00:00
1 parent e5648c1ba0
commit 069f7e155b
1 file changed
+71
@@ -0,0 +1,71 @@
package org.apache.maven.xdoc.util;
/* ====================================================================
* Copyright 2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import junit.framework.TestCase;
/**
* ScmUtil Test class.
*
* @author <a href="mailto:ltheussl@apache.org">Lukas Theussl</a>
*/
public class ScmUtilTest extends TestCase
{
private final ScmUtil scmUtil = new ScmUtil();
private final String cvs1 =
"scm:cvs|pserver|username@localhost|C:/repositories|module_name";
private final String cvs2 =
"scm:cvs:ext:username@cvs.apache.org:/cvs/root:module";
private final String svn = "scm:svn:http://svn.apache.org/svn/root/module";
private final String invalid = "";
public void testSCMConnectionSeparator()
{
assertEquals( scmUtil.getSCMConnectionSeparator( cvs1 ), "|" );
assertEquals( scmUtil.getSCMConnectionSeparator( cvs2 ), ":" );
assertEquals( scmUtil.getSCMConnectionSeparator( svn ), ":" );
}
public void testScmType()
{
assertEquals( scmUtil.getScmType( cvs1 ), "cvs" );
assertEquals( scmUtil.getScmType( cvs2 ), "cvs" );
assertEquals( scmUtil.getScmType( svn ), "svn" );
assertNull( scmUtil.getScmType( invalid ) );
}
public void testCvsModule()
{
assertEquals( scmUtil.getCvsModule( cvs1 ), "module_name" );
assertEquals( scmUtil.getCvsModule( cvs2 ), "module" );
assertNull( scmUtil.getCvsModule( invalid ) );
}
public void testCvsConnection()
{
assertEquals( scmUtil.getCvsConnection( cvs1, "" ),
"scm:cvs|pserver|username|@localhost|C:/repositories|module_name" );
assertEquals( scmUtil.getCvsConnection( cvs1, "john_doe" ),
"scm:cvs|pserver|john_doe@localhost|C:/repositories|module_name" );
assertEquals( scmUtil.getCvsConnection( cvs2, "" ),
"scm:cvs:ext:username:@cvs.apache.org:/cvs/root:module" );
assertEquals( scmUtil.getCvsConnection( cvs2, "john_doe" ),
"scm:cvs:ext:john_doe@cvs.apache.org:/cvs/root:module" );
assertEquals( scmUtil.getCvsConnection( svn, "" ), "" );
}
}