### Question:
DataTypeConstraintModal extends Elemental2Modal<DataTypeConstraintModal.View> { void doSave(final String value) { constraintValue = value; getOnSave().accept(value, constraintType); hide(); } @Inject  DataTypeConstraintModal(final View view,
                                   final DataTypeShortcuts dataTypeShortcuts,
                                   final DataTypeConstraintEnumeration constraintEnumeration,
                                   final DataTypeConstraintExpression constraintExpression,
                                   final DataTypeConstraintRange constraintRange); @PostConstruct void setup(); void save(); void show(final BiConsumer<String, ConstraintType> onSaveConsumer); @Override void hide(); void enableOkButton(); void disableOkButton();  }### Answer:
@Test public void testDoSave() { final String expectedConstraint = "1,2,3"; final ConstraintType expectedConstraintType = ENUMERATION; final BiConsumer<String, ConstraintType> onSave = mock(BiConsumer.class); doNothing().when(modal).hide(); doReturn(onSave).when(modal).getOnSave(); modal.setConstraintType(expectedConstraintType); modal.doSave(expectedConstraint); final String actualConstraint = modal.getConstraintValue(); assertEquals(expectedConstraint, actualConstraint); verify(onSave).accept(expectedConstraint, expectedConstraintType); verify(modal).hide(); }