Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.mockobjects.util
Class Verifier  view Verifier download Verifier.java

java.lang.Object
  extended bycom.mockobjects.util.Verifier

public class Verifier
extends java.lang.Object

Helper class to verify all Expectations of an object. The Verifier class provides two static methods to verify objects:

These two methods can be used to verify any expectation to assert that they still hold.

Example usage:

Verifying all expectations on one object at a time:

 public class MockX implements Verifiable {
    private Expectation... anExpectation = new Expectation...(...);
    private Expectation... aSecondExpectation = new Expectation...(...);

    public void verify() {
       Verifier.verifyObject(this);
    }
 }
 
This example shows how most mocks implement Verifiable, i.e.: by delegation.

Version:
$Id: Verifier.java,v 1.5 2002/09/29 16:44:28 smgf Exp $

Field Summary
private static java.util.Vector myProcessingObjects
           
 
Constructor Summary
Verifier()
           
 
Method Summary
private static boolean isBaseObjectClass(java.lang.Class aClass)
           
private static boolean isVerifiable(java.lang.Object anObject)
           
private static void verifyField(java.lang.reflect.Field aField, java.lang.Object anObject, java.util.Vector alreadyProcessed)
           
private static void verifyFieldsForClass(java.lang.Object anObject, java.lang.Class aClass, java.util.Vector alreadyProcessed)
           
static void verifyObject(java.lang.Object anObject)
          Verifies all the fields of type Verifiable in the given object, including those inherited from superclasses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myProcessingObjects

private static java.util.Vector myProcessingObjects
Constructor Detail

Verifier

public Verifier()
Method Detail

verifyObject

public static void verifyObject(java.lang.Object anObject)
Verifies all the fields of type Verifiable in the given object, including those inherited from superclasses.


verifyFieldsForClass

private static void verifyFieldsForClass(java.lang.Object anObject,
                                         java.lang.Class aClass,
                                         java.util.Vector alreadyProcessed)

verifyField

private static void verifyField(java.lang.reflect.Field aField,
                                java.lang.Object anObject,
                                java.util.Vector alreadyProcessed)

isVerifiable

private static boolean isVerifiable(java.lang.Object anObject)

isBaseObjectClass

private static boolean isBaseObjectClass(java.lang.Class aClass)