Terminology

Class Under Test

the class (or classes) that is (are) currently under test.

Collaborator

Any other classes upon which method calls are made by a Class Under Test

Call

Within the context of VirtualMock, a Call is an expected method call to a Collaborator, which will be intercepted by VirtualMock and "mocked up". The Call specifies any expected arguments (and any verification that will be performed on them), any return value, and any thrown exception

Record Phase

The phase of the test case in which all expected Calls are "recorded"

Playback Phase

The phase of the test case in which the test case makes test calls to the Class Under Test. The recorded Calls are then "played back" when the class being tested invokes the matching method on the matching class, returning values and throwing exceptions as specified.

Verify Phase

The phase of the test case in which verification is done by comparing the expected Calls which were recorded against the actual method invocations by the Class Under Test.

Argument Verifier (ArgVerifier)

A way to specify how an argument passed to a method invocation by the Class Under Test is verified against an expected argument specified in the Call.

Rule

A way to specify and (optionally) enforce what types of behavior VirtualMock should expect from the test case and class being tested, and what do to if something unexpected happens.

Ignored Class or Package

A class which you tell VirtualMock to ignore and not intercept any calls. This is useful because sometimes the AOP framework encounters errors when it tries to modify certain packages or classes.

Structure of a VirtualMock Test Case

TODO: write this

Three phases: Record, Playback, Verify

For now, please review test.functional.SampleTest in the source distribution.

Example of writing a VirtualMock Test Case

Detailed documentation is coming. For now, please see the following classes in the "test" directory of the source distribution: SampleTest.java (the unit test class), Sample.java (the Class Under Test), and SampleCollaborator.java (the collaborator). You can also review the build scripts

TODO: write this