### Question:
ReportLoadingService { public List<ResourceReference> getInputControlReferences(ExecutionContext context, InputControlsContainer container) { List<ResourceReference> inputControlRefs = new ArrayList<ResourceReference>(); container = getFinalResource(context, container); if (container instanceof ReferenceNormalizer) { try { ((ReferenceNormalizer) container).checkReferences(); } catch (Exception e) { ((ReferenceNormalizer) container).normalizeReferences(new MarkAllInputControlsResolved()); } } if (container.getInputControls() != null) { inputControlRefs.addAll(container.getInputControls()); } Resource dataSource = getFinalResource(ExecutionContextImpl.getRuntimeExecutionContext(context), container.getDataSource(), null); if (dataSource instanceof InputControlsContainer && ((InputControlsContainer) dataSource).getInputControls() != null) { if (container.getDataSource() != dataSource && dataSource instanceof ReferenceNormalizer) { try { ((ReferenceNormalizer) dataSource).checkReferences(); } catch (Exception e) { ((ReferenceNormalizer) container).normalizeReferences(new MarkAllInputControlsResolved()); } } List<String> containerInputControlNames = new ArrayList<String>(inputControlRefs.size()); for (ResourceReference ref : inputControlRefs) { containerInputControlNames.add(getInputControlParameterName(ref)); } for (ResourceReference dataSourceControlRef : ((InputControlsContainer) dataSource).getInputControls()) { String dataSourceControlName = getInputControlParameterName(dataSourceControlRef); if (!containerInputControlNames.contains(dataSourceControlName)) { inputControlRefs.add(dataSourceControlRef); } } } return inputControlRefs; }  void setRepositoryService(RepositoryService repository); void setCompiledReportsCache(RepositoryCache compiledReportsCache); void setCacheableCompiledReports(RepositoryCacheableItem cacheableCompiledReports); void setRepositoryContextManager(
            RepositoryContextManager repositoryContextManager); void setBuiltInParameterProviders(List builtInParameterProviders); void setReportParameterLabelKeyPrefix(
            String reportParameterLabelKeyPrefix); RepositoryService getRepositoryService(); List getBuiltInParameterProviders(); String getReportParameterLabelKeyPrefix(); JasperReport getJasperReport(ExecutionContext context, FileResource reportRes, boolean inMemoryUnit); InputStream getFileResourceDataStream(ExecutionContext context, FileResource fileResource); JasperReport compileReport(InputStream jrxmlData); RepositoryContextHandle setThreadRepositoryContext(ExecutionContext context, ResourceContainer reportUnit, String reportUnitURI); void resetThreadRepositoryContext(RepositoryContextHandle repositoryContextHandle); Map getReportParameters(ExecutionContext context, JasperReport report,
                                      Map requestParameters); void setBuiltinParameters(ExecutionContext context, boolean onlyExistingParameters, JRParameter[] existingJRParameters,
                                     Map parametersMap, List additionalParameters); void setBuiltInParameter(ExecutionContext context, boolean onlyExistingParameters, JRParameter[] existingJRParameters,
                                    Map parametersMap, List additionalParameters, Object[] aResult); T getFinalResource(ExecutionContext context, T resource); T getFinalResource(ExecutionContext context, ResourceReference res, Class<T> type); List<ResourceReference> getInputControlReferences(ExecutionContext context, InputControlsContainer container); List<InputControl> getInputControls(ExecutionContext context, InputControlsContainer container);  }### Answer:
@Test public void getInputControlReferencesNull() { boolean fail = false; try { reportLoadingService.getInputControlReferences(null, null); } catch (NullPointerException e) { fail = true; } assertTrue(fail); }
@Test public void getInputControlReferencesOnlyDataSourceControls() { List<ResourceReference> expectedRefs = new ArrayList<>(); expectedRefs.add(createLocalRef("Control0")); expectedRefs.add(createLocalRef("Control1")); expectedRefs.add(createRepositoryRef("Control2")); expectedRefs.add(createRepositoryRef("Control3")); prepareDataSource(expectedRefs); prepareRepositoryService(); InputControlsContainer containerMock = mock(InputControlsContainer.class); when(containerMock.getDataSource()).thenReturn(prepareDataSourceReference()); List<ResourceReference> actualRefs = reportLoadingService.getInputControlReferences(null, containerMock); assertEquals(expectedRefs, actualRefs); }