AddAttributeWidget implements IsWidget { public void showAttributeSelectorPopup() { final GuidedRuleAttributeSelectorPopup popup = GWT.create(GuidedRuleAttributeSelectorPopup.class); popup.init(ruleModeller.getModel(), ruleModeller.lockLHS(), ruleModeller.lockRHS(), () -> ruleModeller.refreshWidget()); popup.show(); } AddAttributeWidget(); void init(final RuleModeller ruleModeller); @Override Widget asWidget(); void showAttributeSelectorPopup();  }
@Test public void testShowAttributeSelectorPopup() { final RuleModel model = mock(RuleModel.class); final boolean lockLHS = false; final boolean lockRHS = true; doReturn(model).when(ruleModeller).getModel(); doReturn(lockLHS).when(ruleModeller).lockLHS(); doReturn(lockRHS).when(ruleModeller).lockRHS(); addAttributeWidget.init(ruleModeller); addAttributeWidget.showAttributeSelectorPopup(); verify(guidedRuleAttributeSelectorPopup).init(eq(model), eq(lockLHS), eq(lockRHS), commandArgumentCaptor.capture()); commandArgumentCaptor.getValue().execute(); verify(ruleModeller).refreshWidget(); }