beehive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Snow <>
Subject testing controls
Date Thu, 30 Aug 2007 12:46:07 GMT
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

Thanks in advance ...

public class ControlAImpl ... {

   private ControlB controlB;

   public void setControlB( ControlB control ) {
      controlB = control

   // business logic

public interface ControlA ...{
    // bad idea? non business method in business interface
    public void setControlB( ControlB control );

public class ControlAImplTest extends ControlTestCase {

   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.

View raw message