improved test coverage. (The original AllTests test suites were generated

with the Eclipse new JUnit Test Suite wizard that recognizes all test cases
in the target folder.)
This commit is contained in:
Rick Giles 2002-12-08 10:39:41 +00:00
parent b2704f029a
commit 8e949ff141
2 changed files with 53 additions and 0 deletions

View File

@ -108,6 +108,7 @@ public class AllTests {
suite.addTest(new TestSuite(OtherLeftCurlyCheckTest.class));
suite.addTest(new TestSuite(PackageHtmlCheckTest.class));
suite.addTest(new TestSuite(PackageNameCheckTest.class));
suite.addTest(new TestSuite(PackageObjectFactoryTest.class));
suite.addTest(new TestSuite(ParameterNameCheckTest.class));
suite.addTest(new TestSuite(ParameterNumberCheckTest.class));
suite.addTest(new TestSuite(ParenPadCheckTest.class));

View File

@ -0,0 +1,52 @@
package com.puppycrawl.tools.checkstyle;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
import junit.framework.TestCase;
/**
* Enter a description of class PackageObjectFactoryTest.java.
* @author Rick Giles
* @version 8-Dec-2002
*/
public class PackageObjectFactoryTest extends TestCase
{
public void testMakeObectFromName()
throws CheckstyleException
{
PackageObjectFactory factory =
(PackageObjectFactory) PackageObjectFactory.makeObject(
new String [] {},
this.getClass().getClassLoader(),
"com.puppycrawl.tools.checkstyle.PackageObjectFactory");
}
public void testMakeObectFromList()
throws CheckstyleException
{
PackageObjectFactory factory =
(PackageObjectFactory) PackageObjectFactory.makeObject(
new String [] {"com."},
this.getClass().getClassLoader(),
"puppycrawl.tools.checkstyle.PackageObjectFactory");
}
public void testMakeObectNoClass()
throws CheckstyleException
{
try {
PackageObjectFactory factory =
(PackageObjectFactory) PackageObjectFactory.makeObject(
new String [] {},
this.getClass().getClassLoader(),
"NoClass");
fail("Instantiated non-existant class");
}
catch (CheckstyleException ex) {
assertEquals("CheckstyleException.message",
"Unable to instantiate NoClass",
ex.getMessage());
}
}
}