### Question:
DataTypeConstraintView implements DataTypeConstraint.View { @Override public void hideAnchor() { if (Objects.equals(constraintsLabelText.textContent, addConstraints())) { hide(constraintsLabelContainer); } else { show(constraintsLabelContainer); } hide(constraintsAnchorContainer); hide(constraintsTooltip); } @Inject  DataTypeConstraintView(final HTMLAnchorElement constraintsAnchorContainer,
                                  final HTMLDivElement constraintsLabelContainer,
                                  final @Named("span") HTMLElement constraintsAnchorText,
                                  final @Named("span") HTMLElement constraintsLabelText,
                                  final @Named("span") HTMLElement constraintsTooltip,
                                  final TranslationService translationService); @Override void init(final DataTypeConstraint presenter); @PostConstruct void setup(); @EventHandler("constraints-anchor-container") void onConstraintsClick(final ClickEvent e); @Override void showAnchor(); @Override void hideAnchor(); @Override void setText(final String text); @Override void enable(); @Override void disable();  }### Answer:
@Test public void testHideAnchorWhenLabelTextIsConstraints() { final String addConstraints = "Add Constraints"; when(translationService.format(DataTypeConstraintView_AddConstraints)).thenReturn(addConstraints); constraintsLabelContainer.classList = mock(DOMTokenList.class); constraintsAnchorContainer.classList = mock(DOMTokenList.class); constraintsTooltip.classList = mock(DOMTokenList.class); constraintsLabelText.textContent = addConstraints; view.hideAnchor(); verify(constraintsLabelContainer.classList).add(HIDDEN_CSS_CLASS); verify(constraintsAnchorContainer.classList).add(HIDDEN_CSS_CLASS); verify(constraintsTooltip.classList).add(HIDDEN_CSS_CLASS); }
@Test public void testHideAnchorWhenLabelTextIsNotConstraints() { final String addConstraints = "Add Constraints"; when(translationService.format(DataTypeConstraintView_AddConstraints)).thenReturn(addConstraints); constraintsLabelContainer.classList = mock(DOMTokenList.class); constraintsAnchorContainer.classList = mock(DOMTokenList.class); constraintsTooltip.classList = mock(DOMTokenList.class); constraintsLabelText.textContent = "1, 2, 3"; view.hideAnchor(); verify(constraintsLabelContainer.classList).remove(HIDDEN_CSS_CLASS); verify(constraintsAnchorContainer.classList).add(HIDDEN_CSS_CLASS); verify(constraintsTooltip.classList).add(HIDDEN_CSS_CLASS); }