I have a control (ControlA) that has a reference to another control (ControlB).
I would like to test ControlA using a mock of ControlB. I have created a
setting to set ControlA's reference to ControlB from the test case. However to
do this, I need to put the setter in the business interface. Is there a better
way?
Thanks in advance ...
@ControlImplementation
public class ControlAImpl ... {
@Control
private ControlB controlB;
public void setControlB( ControlB control ) {
controlB = control
}
// business logic
}
@ControlInterface
public interface ControlA ...{
// bad idea? non business method in business interface
public void setControlB( ControlB control );
}
public class ControlAImplTest extends ControlTestCase {
@Control
private ControlA controlA;
public void testX() {
ControlB mockControlB = // create mock of ControlB
controlA.setControlB( mockControlB )
// test business logic here
}
}
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.