### Question:
DataTypeConstraintModal extends Elemental2Modal<DataTypeConstraintModal.View> { ConstraintType inferComponentType(final String constraintValue) { final String value = Optional.ofNullable(constraintValue).orElse(""); if (isRange(value)) { return RANGE; } else if (isEnumeration(value)) { return ENUMERATION; } else { return EXPRESSION; } } @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 testInferComponentTypeWhenItReturnsRange() { final ConstraintType expectedType = RANGE; final ConstraintType actualType = modal.inferComponentType("(1..3]"); assertEquals(expectedType, actualType); }
@Test public void testInferComponentTypeWhenItReturnsEnumeration() { final ConstraintType expectedType = ENUMERATION; final ConstraintType actualType = modal.inferComponentType("1,2,3"); assertEquals(expectedType, actualType); }
@Test public void testInferComponentTypeWhenItReturnsExpression() { final ConstraintType expectedType = EXPRESSION; final ConstraintType actualType = modal.inferComponentType("expression"); assertEquals(expectedType, actualType); }