-
Notifications
You must be signed in to change notification settings - Fork 19
Accessing Constructors
stephanenicolas edited this page Sep 12, 2013
·
13 revisions
BoundBox provides access to all constructors defined in a given class.
Let's say we have a class A like :
public class A {
private A(String foo) {
}
}
With BoundBox, you can write a test that accesses constructors of A :
@BoundBox( boundClass = A.class )
public class ATest {
@Test
public void testConstructor() {
//GIVEN
A a = BoundBoxOfA.new("bb");
//WHEN
//THEN
assertNotNull(a);
assertTrue(a instanceof A);
}
}
For all constructors defined in a class A, its BoundBox will contain a method prefixed with boundBox_new
. Each of those "factory methods" will have the exact same list of parameters as each wrapped constructor.