Code example for CheckBox

Methods: performClick, setId

0
  /** 
   * Verify on check helpers 
   */ 
  @Test 
  public void onCheckRunnable() { 
    CheckBox checkbox = new CheckBox(new Activity());
    checkbox.setId(android.R.id.button1);
    ViewFinder finder = new ViewFinder(checkbox);
    final AtomicBoolean run = new AtomicBoolean(false);
    finder.onCheck(android.R.id.button1, new Runnable() {
 
      public void run() { 
        run.set(true);
      } 
    }); 
    checkbox.performClick();
    assertTrue(run.get());
  } 
 
  /** 
   * Verify on check helpers