title: How to test BarButtonItem is connected to right IBAction?
body: <p>I have seen this for a normal UIButton:</p>
  
  <pre><code>NSArray *actions = [viewController.addButton actionsForTarget:viewController forControlEvent:UIControlEventTouchUpInside];
  XCTAssertTrue([actions containsObject:@”addNumbers:”], @””);
  </code></pre>
  
  <p>But now I want to do same thing for a rightBarButtonItem! I have tested this button exist on the VC but there is no interface actionForTargets!</p>
  
  <p>I tried this also but it did not work:</p>
  
  <pre><code>NSArray *actions = [self.navigationItem.rightBarButtonItem actionsForTarget:self forControlEvent:UIControlEventTouchUpInside];
  </code></pre>
  
  <p>or</p>
  
  <pre><code>NSArray *actions = [[self.navigationItem.rightBarButtonItem target] actionsForTarget:self forControlEvent:UIControlEventTouchUpInside];
  </code></pre>
  
  <p>Non of them works. Anyone has written test code for a UIBarButton to check if button is connected to correct IBAction?</p>