Skip to content
stephanenicolas edited this page Sep 17, 2013 · 6 revisions

Before getting started, you must have a working setup. Refer to the wiki to set it up properly for your build tools / IDE.

Basics

The main feature of BoundBox consists of a single annotation : @BoundBox.

For instance, you can annotate a test class using @BoundBox.

@BoundBox(boundClass=Foo.class)
public class FooTest {
 private BoundBoxOfFoo bbFoo;
}

You could also place the annotation on the field itself :

public class FooTest {
 @BoundBox(boundClass=Foo.class)
 private BoundBoxOfFoo bbFoo;
}

This has the exact same meaning.

When using, inside a java file, @BoundBox(boundClass=Foo.class) : the annotation processor of BoundBox will generate a class named BoundBoxOfFoo that will let you access all the fields, constructors and methods of the class Foo.

Inside an IDE that is configured to use annotations during edition, the BoundBoxOfFoo class will become available immediately, as soon as you type @BoundBox(boundClass=Foo.class).

Using multiple BoundBoxes

Usually, if you use a single BoundBox in a test, you can annotate the test class itself. But, if you use several BoundBoxes inside a test class, then you must annotate each field (as Java prohibits multiple annotations using the same annotation for any syntax element) :

public class FooAndBarTest {
 @BoundBox(boundClass=Foo.class)
 private BoundBoxOfFoo bbFoo;
 @BoundBox(boundClass=Bar.class)
 private BoundBoxOfBar bbBar;
}

Refer to the wiki to learn how to access different elements of a given class using BoundBox.

Clone this wiki locally