Files
maven-plugins/changelog/src/test/org/apache/maven/mkslib/MksChangeLogParserTest.java
T
ltheussl e424286e61 PR: MPCHANGELOG-80
Submitted by: Christoph Jerolimov
Add MKS SI support


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@370578 13f79535-47bb-0310-9956-ffa450edef68
2006-01-19 19:29:01 +00:00

92 lines
2.8 KiB
Java

package org.apache.maven.mkslib;
/* ====================================================================
* 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;
import org.apache.maven.changelog.ChangeLogEntry;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
/**
* This class test the mks parser with an inputstream.
*
* @author dion (writes CvsChangeLogParserTest)
* @author <a href="mailto:c.jerolimov@tarent.de">Christoph Jerolimov</a>
* @version $Id$
*/
public class MksChangeLogParserTest extends TestCase
{
/** the {@link MksChangeLogParser} used for testing */
private MksChangeLogParser instance;
/** file with test results to check against */
private String testFile;
/**
* Create a test with the given name
* @param testName the name of the test
*/
public MksChangeLogParserTest( String testName )
{
super( testName );
}
/**
* 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/mkslib/mkslog.txt";
instance = new MksChangeLogParser();
}
/**
* Test the mks parser.
* @throws IOException when there is an unexpected problem
*/
public void testParser()
throws IOException
{
FileInputStream fis = new FileInputStream( testFile );
Collection entries = instance.parse( fis );
assertEquals( "Wrong number of entries returned", 3, entries.size() );
ChangeLogEntry entry = null;
for ( Iterator i = entries.iterator(); i.hasNext(); )
{
entry = (ChangeLogEntry) i.next();
assertEquals( "Wrong author parsed", "AUTHOR", entry.getAuthor() );
System.out.println( entry );
assertTrue( "ChangeLogEntry erroneously picked up",
entry.toString().indexOf( "ChangeLogEntry.java" ) == -1 );
}
}
}