GuidedRuleAttributeSelectorPopup extends AttributeSelectorPopup { @Override protected void handleAttributeAddition(final String attributeName) { if (attributeName.equals(RuleAttributeWidget.LOCK_LHS) || attributeName.equals(RuleAttributeWidget.LOCK_RHS)) { model.addMetadata(new RuleMetadata(attributeName, "true")); } else { model.addAttribute(new RuleAttribute(attributeName, "")); } refresh.execute(); }  void init(final RuleModel model,
                     final boolean lockLHS,
                     final boolean lockRHS,
                     final Command refresh);  }
@Test public void testHandleAttributeAddition_Calendars() { popup.handleAttributeAddition(Attribute.CALENDARS.getAttributeName()); assertThat(model.attributes).containsExactly(new RuleAttribute(Attribute.CALENDARS.getAttributeName(), "")); assertThat(model.metadataList).isEmpty(); verify(refreshCommand).execute(); }
@Test public void testHandleAttributeAddition_Timer() { popup.handleAttributeAddition(Attribute.TIMER.getAttributeName()); assertThat(model.attributes).containsExactly(new RuleAttribute(Attribute.TIMER.getAttributeName(), "")); assertThat(model.metadataList).isEmpty(); verify(refreshCommand).execute(); }
@Test public void testHandleAttributeAddition_LockRHS() { popup.handleAttributeAddition(RuleAttributeWidget.LOCK_RHS); assertThat(model.attributes).isEmpty(); assertThat(model.metadataList).containsExactly(new RuleMetadata(RuleAttributeWidget.LOCK_RHS, "true")); verify(refreshCommand).execute(); }
@Test public void testHandleAttributeAddition_LockLHS() { popup.handleAttributeAddition(RuleAttributeWidget.LOCK_LHS); assertThat(model.attributes).isEmpty(); assertThat(model.metadataList).containsExactly(new RuleMetadata(RuleAttributeWidget.LOCK_LHS, "true")); verify(refreshCommand).execute(); }