Java Doc for BulkTest.java in  » Library » Apache-common-Collections » org » apache » commons » collections » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache common Collections » org.apache.commons.collections 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.commons.collections.BulkTest

All known Subclasses:   org.apache.commons.collections.AbstractTestObject,  org.apache.commons.collections.TestTypedCollection,  org.apache.commons.collections.TestSetUtils,  org.apache.commons.collections.TestListUtils,  org.apache.commons.collections.TestEnumerationUtils,  org.apache.commons.collections.TestMapUtils,  org.apache.commons.collections.TestIteratorUtils,  org.apache.commons.collections.TestBufferUtils,  org.apache.commons.collections.TestBagUtils,
BulkTest
public class BulkTest extends TestCase implements Cloneable(Code)
A TestCase that can define both simple and bulk test methods.

A simple test method is the type of test traditionally supplied by by TestCase . To define a simple test, create a public no-argument method whose name starts with "test". You can specify the the name of simple test in the constructor of BulkTest; a subsequent call to TestCase.run will run that simple test.

A bulk test method, on the other hand, returns a new instance of BulkTest, which can itself define new simple and bulk test methods. By using the BulkTest.makeSuite method, you can automatically create a hierarchal suite of tests and child bulk tests.

For instance, consider the following two classes:

 public class TestSet extends BulkTest {
 private Set set;
 public TestSet(Set set) {
 this.set = set;
 }
 public void testContains() {
 boolean r = set.contains(set.iterator().next()));
 assertTrue("Set should contain first element, r);
 }
 public void testClear() {
 set.clear();
 assertTrue("Set should be empty after clear", set.isEmpty());
 }
 }
 public class TestHashMap extends BulkTest {
 private Map makeFullMap() {
 HashMap result = new HashMap();
 result.put("1", "One");
 result.put("2", "Two");
 return result;
 }
 public void testClear() {
 Map map = makeFullMap();
 map.clear();
 assertTrue("Map empty after clear", map.isEmpty());
 }
 public BulkTest bulkTestKeySet() {
 return new TestSet(makeFullMap().keySet());
 }
 public BulkTest bulkTestEntrySet() {
 return new TestSet(makeFullMap().entrySet());
 }
 }
 
In the above examples, TestSet defines two simple test methods and no bulk test methods; TestHashMap defines one simple test method and two bulk test methods. When makeSuite(TestHashMap.class).run is executed, five simple test methods will be run, in this order:

  1. TestHashMap.testClear()
  2. TestHashMap.bulkTestKeySet().testContains();
  3. TestHashMap.bulkTestKeySet().testClear();
  4. TestHashMap.bulkTestEntrySet().testContains();
  5. TestHashMap.bulkTestEntrySet().testClear();
In the graphical junit test runners, the tests would be displayed in the following tree:

  • TestHashMap
    • testClear
    • bulkTestKeySet
      • testContains
      • testClear
    • bulkTestEntrySet
      • testContains
      • testClear
A subclass can override a superclass's bulk test by returning null from the bulk test method. If you only want to override specific simple tests within a bulk test, use the BulkTest.ignoredTests method.

Note that if you want to use the bulk test methods, you must define your suite() method to use BulkTest.makeSuite . The ordinary TestSuite constructor doesn't know how to interpret bulk test methods.
author:
   Paul Jack
version:
   $Id: BulkTest.java 201765 2005-06-25 16:39:34Z scolebourne $



Field Summary
 StringverboseName
     The full name of this bulk test instance.

Constructor Summary
public  BulkTest(String name)
     Constructs a new BulkTest instance that will run the specified simple test.

Method Summary
public  Objectclone()
    
public  String[]ignoredTests()
     Returns an array of test names to ignore.

If a test that's defined by this BulkTest or by one of its bulk test methods has a name that's in the returned array, then that simple test will not be executed.

A test's name is formed by taking the class name of the root BulkTest, eliminating the package name, then appending the names of any bulk test methods that were invoked to get to the simple test, and then appending the simple test method name.

public static  TestSuitemakeSuite(Class c)
    
public  StringtoString()
     Returns the display name of this BulkTest.

Field Detail
verboseName
String verboseName(Code)
The full name of this bulk test instance. This is the full name that is compared to BulkTest.ignoredTests to see if this test should be ignored. It's also displayed in the text runner to ease debugging.




Constructor Detail
BulkTest
public BulkTest(String name)(Code)
Constructs a new BulkTest instance that will run the specified simple test.
Parameters:
  name - the name of the simple test method to run




Method Detail
clone
public Object clone()(Code)
Creates a clone of this BulkTest.

a clone of this BulkTest




ignoredTests
public String[] ignoredTests()(Code)
Returns an array of test names to ignore.

If a test that's defined by this BulkTest or by one of its bulk test methods has a name that's in the returned array, then that simple test will not be executed.

A test's name is formed by taking the class name of the root BulkTest, eliminating the package name, then appending the names of any bulk test methods that were invoked to get to the simple test, and then appending the simple test method name. The method names are delimited by periods:

 TestHashMap.bulkTestEntrySet.testClear
 
is the name of one of the simple tests defined in the sample classes described above. If the sample TestHashMap class included this method:
 public String[] ignoredTests() {
 return new String[] { "TestHashMap.bulkTestEntrySet.testClear" };
 }
 
then the entry set's clear method wouldn't be tested, but the key set's clear method would. an array of the names of tests to ignore, or null ifno tests should be ignored



makeSuite
public static TestSuite makeSuite(Class c)(Code)
Returns a TestSuite for testing all of the simple tests and all the bulk tests defined by the given class.

The class is examined for simple and bulk test methods; any child bulk tests are also examined recursively; and the results are stored in a hierarchal TestSuite .

The given class must be a subclass of BulkTest and must not be abstract.


Parameters:
  c - the class to examine for simple and bulk tests a TestSuite containing all the simple and bulk testsdefined by that class




toString
public String toString()(Code)
Returns the display name of this BulkTest. the display name of this BulkTest



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.