Java Doc for AbstractTestObject.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
   org.apache.commons.collections.AbstractTestObject

All known Subclasses:   org.apache.commons.collections.iterators.AbstractTestIterator,  org.apache.commons.collections.buffer.TestBoundedBuffer,  org.apache.commons.collections.bag.AbstractTestBag,  org.apache.commons.collections.buffer.TestBlockingBuffer,  org.apache.commons.collections.comparators.AbstractTestComparator,  org.apache.commons.collections.map.AbstractTestMap,  org.apache.commons.collections.collection.AbstractTestCollection,  org.apache.commons.collections.map.TestIdentityMap,
AbstractTestObject
abstract public class AbstractTestObject extends BulkTest (Code)
Abstract test class for java.lang.Object methods and contracts.

To use, simply extend this class, and implement the AbstractTestObject.makeObject() method.

If your Object fails one of these tests by design, you may still use this base set of cases. Simply override the test case (method) your Object fails.
version:
   $Revision: 155406 $ $Date: 2005-02-26 12:55:26 +0000 (Sat, 26 Feb 2005) $
author:
   Rodney Waldhoff
author:
   Stephen Colebourne
author:
   Anonymous



Field Summary
final public static  intCOLLECTIONS_MAJOR_VERSION
    

Constructor Summary
public  AbstractTestObject(String testName)
     JUnit constructor.

Method Summary
protected  StringgetCanonicalEmptyCollectionName(Object object)
    
protected  StringgetCanonicalFullCollectionName(Object object)
    
public  StringgetCompatibilityVersion()
     Get the version of Collections that this object tries to maintain serialization compatibility with.
public  booleanisEqualsCheckable()
     Returns true to indicate that the collection supports equals() comparisons.
public  booleanisTestSerialization()
     Is serialization testing supported.
abstract public  ObjectmakeObject()
     Implement this method to return the object to test.
protected  ObjectreadExternalFormFromBytes(byte[] b)
     Read a Serialized or Externalized Object from bytes.
protected  ObjectreadExternalFormFromDisk(String path)
     Reads a Serialized or Externalized Object from disk.
protected  booleanskipSerializedCanonicalTests()
    
public  booleansupportsEmptyCollections()
     Override this method if a subclass is testing an object that cannot serialize an "empty" Collection. (e.g.
public  booleansupportsFullCollections()
     Override this method if a subclass is testing an object that cannot serialize a "full" Collection. (e.g.
public  voidtestCanonicalEmptyCollectionExists()
     Tests serialization by comparing against a previously stored version in CVS.
public  voidtestCanonicalFullCollectionExists()
     Tests serialization by comparing against a previously stored version in CVS.
public  voidtestEqualsNull()
    
public  voidtestObjectEqualsSelf()
    
public  voidtestObjectHashCodeEqualsContract()
    
public  voidtestObjectHashCodeEqualsSelfHashCode()
    
public  voidtestSerializeDeserializeThenCompare()
    
public  voidtestSimpleSerialization()
    
protected  byte[]writeExternalFormToBytes(Serializable o)
     Converts a Serializable or Externalizable object to bytes.
protected  voidwriteExternalFormToDisk(Serializable o, String path)
     Write a Serializable or Externalizable object as a file at the given path.

Field Detail
COLLECTIONS_MAJOR_VERSION
final public static int COLLECTIONS_MAJOR_VERSION(Code)
Current major release for Collections




Constructor Detail
AbstractTestObject
public AbstractTestObject(String testName)(Code)
JUnit constructor.
Parameters:
  testName - the test class name




Method Detail
getCanonicalEmptyCollectionName
protected String getCanonicalEmptyCollectionName(Object object)(Code)



getCanonicalFullCollectionName
protected String getCanonicalFullCollectionName(Object object)(Code)



getCompatibilityVersion
public String getCompatibilityVersion()(Code)
Get the version of Collections that this object tries to maintain serialization compatibility with. Defaults to 1, the earliest Collections version. (Note: some collections did not even exist in this version). This constant makes it possible for TestMap (and other subclasses, if necessary) to automatically check CVS for a versionX copy of a Serialized object, so we can make sure that compatibility is maintained. See, for example, TestMap.getCanonicalFullMapName(Map map). Subclasses can override this variable, indicating compatibility with earlier Collections versions. The version, or null if this object shouldn't betested for compatibility with previous versions.



isEqualsCheckable
public boolean isEqualsCheckable()(Code)
Returns true to indicate that the collection supports equals() comparisons. This implementation returns true;



isTestSerialization
public boolean isTestSerialization()(Code)
Is serialization testing supported. Default is true.



makeObject
abstract public Object makeObject()(Code)
Implement this method to return the object to test. the object to test



readExternalFormFromBytes
protected Object readExternalFormFromBytes(byte[] b) throws IOException, ClassNotFoundException(Code)
Read a Serialized or Externalized Object from bytes. Useful for verifying serialization in memory.
Parameters:
  b - byte array containing a serialized Object Object contained in the bytes
exception:
  IOException -
exception:
  ClassNotFoundException -



readExternalFormFromDisk
protected Object readExternalFormFromDisk(String path) throws IOException, ClassNotFoundException(Code)
Reads a Serialized or Externalized Object from disk. Useful for creating compatibility tests between different CVS versions of the same class
Parameters:
  path - path to the serialized Object the Object at the given path
exception:
  IOException -
exception:
  ClassNotFoundException -



skipSerializedCanonicalTests
protected boolean skipSerializedCanonicalTests()(Code)



supportsEmptyCollections
public boolean supportsEmptyCollections()(Code)
Override this method if a subclass is testing an object that cannot serialize an "empty" Collection. (e.g. Comparators have no contents) true



supportsFullCollections
public boolean supportsFullCollections()(Code)
Override this method if a subclass is testing an object that cannot serialize a "full" Collection. (e.g. Comparators have no contents) true



testCanonicalEmptyCollectionExists
public void testCanonicalEmptyCollectionExists()(Code)
Tests serialization by comparing against a previously stored version in CVS. If the test object is serializable, confirm that a canonical form exists.



testCanonicalFullCollectionExists
public void testCanonicalFullCollectionExists()(Code)
Tests serialization by comparing against a previously stored version in CVS. If the test object is serializable, confirm that a canonical form exists.



testEqualsNull
public void testEqualsNull()(Code)



testObjectEqualsSelf
public void testObjectEqualsSelf()(Code)



testObjectHashCodeEqualsContract
public void testObjectHashCodeEqualsContract()(Code)



testObjectHashCodeEqualsSelfHashCode
public void testObjectHashCodeEqualsSelfHashCode()(Code)



testSerializeDeserializeThenCompare
public void testSerializeDeserializeThenCompare() throws Exception(Code)



testSimpleSerialization
public void testSimpleSerialization() throws Exception(Code)
Sanity check method, makes sure that any Serializable class can be serialized and de-serialized in memory, using the handy makeObject() method
throws:
  IOException -
throws:
  ClassNotFoundException -



writeExternalFormToBytes
protected byte[] writeExternalFormToBytes(Serializable o) throws IOException(Code)
Converts a Serializable or Externalizable object to bytes. Useful for in-memory tests of serialization
Parameters:
  o - Object to convert to bytes serialized form of the Object
exception:
  IOException -



writeExternalFormToDisk
protected void writeExternalFormToDisk(Serializable o, String path) throws IOException(Code)
Write a Serializable or Externalizable object as a file at the given path. NOT USEFUL as part of a unit test; this is just a utility method for creating disk-based objects in CVS that can become the basis for compatibility tests using readExternalFormFromDisk(String path)
Parameters:
  o - Object to serialize
Parameters:
  path - path to write the serialized Object
exception:
  IOException -



Fields inherited from org.apache.commons.collections.BulkTest
String verboseName(Code)(Java Doc)

Methods inherited from org.apache.commons.collections.BulkTest
public Object clone()(Code)(Java Doc)
public String[] ignoredTests()(Code)(Java Doc)
public static TestSuite makeSuite(Class c)(Code)(Java Doc)
public String toString()(Code)(Java Doc)

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