@Test
public void testOnExpressionEditorButtonClick() {

    final String factType = "factType";
    final FactPattern factPattern = mock(FactPattern.class);
    final HasConstraints hasConstraints = mock(HasConstraints.class);
    final FormStylePopup popup = mock(FormStylePopup.class);
    final SingleFieldConstraintEBLeftSide constraint = mock(SingleFieldConstraintEBLeftSide.class);
    final RuleModeller ruleModeller = mock(RuleModeller.class);
    final ClickEvent clickEvent = mock(ClickEvent.class);
    doReturn(factType).when(factPattern).getFactType();
    doReturn(constraint).when(popupCreator).makeSingleFieldConstraintEBLeftSide(factType);
    doReturn(ruleModeller).when(popupCreator).getModeller();
    doReturn(factPattern).when(popupCreator).getPattern();
    final ClickHandler clickHandler = popupCreator.onExpressionEditorButtonClick(hasConstraints, popup);
    clickHandler.onClick(clickEvent);
    verify(hasConstraints).addConstraint(constraint);
    verify(ruleModeller).refreshWidget();
    verify(popup).hide();
}