### Question:
BasicInputControlHandler implements InputControlHandler { @Override public ReportInputControl buildReportInputControl(InputControl inputControl, String uiType, ResourceReference dataSource) throws CascadeResourceNotFoundException { ReportInputControl control = new ReportInputControl(); control.setId(inputControl.getName()); control.setLabel(inputControl.getLabel()); control.setDescription(inputControl.getDescription()); control.setUri(inputControl.getURI()); control.setMandatory(inputControl.isMandatory()); control.setReadOnly(inputControl.isReadOnly()); control.setVisible(inputControl.isVisible()); control.setType(getType(inputControl, uiType)); final List<ValidationRule> validationRules = getValidationRules(inputControl); if (validationRules != null && !validationRules.isEmpty()) { control.setValidationRules(validationRules); } final ResourceReference dataTypeReference = inputControl.getDataType(); if(dataTypeReference != null){ final DataType dataType = dataTypeReference.isLocal() ? (DataType) dataTypeReference.getLocalResource() : cachedRepositoryService.getResource(DataType.class, dataTypeReference.getReferenceURI()); if(dataType != null && dataTypeResourceConverter != null) { control.setDataType(dataTypeResourceConverter.toClient(dataType, ToClientConversionOptions.getDefault())); } } return control; }  @PostConstruct void init(); @Override void applyNothingSelected(String controlName, Map<String, Object> parameters); @Override boolean isNothingSelected(String[] rawData); @Override Set<String> getMasterDependencies(InputControl control, ResourceReference dataSource); @Override ReportInputControl buildReportInputControl(InputControl inputControl, String uiType, ResourceReference dataSource); @Override final InputControlState getState(InputControl inputControl, ResourceReference dataSource, Map<String, Object> parameters, Map<String, Class<?>> parameterTypes, ReportInputControlInformation info); @Override final Object convertParameterValueFromRawData(String[] rawData, InputControl inputControl, ReportInputControlInformation info); @Override String[] formatValue(Object typedValue, InputControl inputControl, ReportInputControlInformation info); static final String MULTI_DATA_TYPE_UI_TYPE; }### Answer:
@Test public void buildReportInputControl_localDataType() throws CascadeResourceNotFoundException { final InputControlImpl inputControl = new InputControlImpl(); final DataTypeImpl dataType = new DataTypeImpl(); inputControl.setDataType(dataType); final ClientDataType clientDataType = new ClientDataType().setMaxValue("100").setMinValue("10") .setStrictMax(true).setStrictMin(true); doReturn(clientDataType).when(dataTypeResourceConverter).toClient(eq(dataType), eq(ToClientConversionOptions.getDefault())); final ReportInputControl result = handler.buildReportInputControl(inputControl, null, null); assertNotNull(result); assertEquals(clientDataType, result.getDataType()); }
@Test public void buildReportInputControl_referenceDataType() throws CascadeResourceNotFoundException { final InputControlImpl inputControl = new InputControlImpl(); final DataTypeImpl dataType = new DataTypeImpl(); final String referenceUri = "/test/resource/reference"; inputControl.setDataTypeReference(referenceUri); final ClientDataType clientDataType = new ClientDataType().setMaxValue("100").setMinValue("10") .setStrictMax(true).setStrictMin(true); doReturn(clientDataType).when(dataTypeResourceConverter).toClient(eq(dataType), eq(ToClientConversionOptions.getDefault())); doReturn(dataType).when(cachedRepositoryService).getResource(eq(DataType.class), eq(referenceUri)); final ReportInputControl result = handler.buildReportInputControl(inputControl, null, null); assertNotNull(result); assertEquals(clientDataType, result.getDataType()); }