org.unitils.mock.annotation
Annotation Type Dummy


@Target(value=FIELD)
@Retention(value=RUNTIME)
public @interface Dummy

Annotation that can be used on fields to create dummy objects for these fields. A dummy object is a proxy that will return default values for every method. This can be used to quickly create test objects without having to worry about correctly filling in every field. Even classes with non-public default constructors can be dummyfied by annotating the field. Example:

This will create a proxy for MyClass that will return default values for all methods. The dummy will be created regardless whether there is a default constructor.

Following defaults are used:



Copyright © 2011. All Rights Reserved.