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:
parent
b2704f029a
commit
8e949ff141
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue