@Before
	public void setupFindDefinitionResults() throws IOException {
		ArrayList<ModuleDefinition> moduleDefinitions = new ArrayList<ModuleDefinition>();
		ArrayList<ModuleDefinition> jobDefinitions = new ArrayList<ModuleDefinition>();
		ArrayList<ModuleDefinition> processorDefinitions = new ArrayList<ModuleDefinition>();
		ArrayList<ModuleDefinition> sinkDefinitions = new ArrayList<ModuleDefinition>();
		ArrayList<ModuleDefinition> sourceDefinitions = new ArrayList<ModuleDefinition>();

		for (int moduleCount = 0; moduleCount < 3; moduleCount++) {

			ModuleDefinition moduleDefinition = TestModuleDefinitions.dummy("job_" + moduleCount, ModuleType.job);
			moduleDefinitions.add(moduleDefinition);
			jobDefinitions.add(moduleDefinition);

			moduleDefinition = TestModuleDefinitions.dummy("source_" + moduleCount, ModuleType.source);
			moduleDefinitions.add(moduleDefinition);
			sourceDefinitions.add(moduleDefinition);

			moduleDefinition = TestModuleDefinitions.dummy("sink_" + moduleCount, ModuleType.sink);
			moduleDefinitions.add(moduleDefinition);
			sinkDefinitions.add(moduleDefinition);

			moduleDefinition = TestModuleDefinitions.dummy("processor_" + moduleCount, ModuleType.processor);
			moduleDefinitions.add(moduleDefinition);
			processorDefinitions.add(moduleDefinition);
		}


		ModuleDefinition moduleDefinition = ModuleDefinitions.simple("job_4_with_resource", ModuleType.job, "file:" + temporaryFolder.getRoot().getAbsolutePath() + "/");
		moduleDefinitions.add(moduleDefinition);
		jobDefinitions.add(moduleDefinition);

		for (int i = 0; i < 3; i++) {
			when(moduleRegistry.findDefinition("source_" + i, ModuleType.source)).thenReturn(sourceDefinitions.get(i));
			when(moduleRegistry.findDefinitions("source_" + i)).thenReturn(
					Collections.singletonList(sourceDefinitions.get(i)));
			when(moduleRegistry.findDefinition("processor_" + i, ModuleType.processor)).thenReturn(
					processorDefinitions.get(i));
			when(moduleRegistry.findDefinitions("processor_" + i)).thenReturn(
					Collections.singletonList(processorDefinitions.get(i)));
			when(moduleRegistry.findDefinition("sink_" + i, ModuleType.sink)).thenReturn(sinkDefinitions.get(i));
			when(moduleRegistry.findDefinitions("sink_" + i)).thenReturn(
					Collections.singletonList(sinkDefinitions.get(i)));
		}
		when(moduleRegistry.findDefinitions(ModuleType.sink)).thenReturn(sinkDefinitions);
		when(moduleRegistry.findDefinitions(ModuleType.source)).thenReturn(sourceDefinitions);
		when(moduleRegistry.findDefinitions(ModuleType.job)).thenReturn(jobDefinitions);
		when(moduleRegistry.findDefinitions(ModuleType.processor)).thenReturn(processorDefinitions);
		when(moduleRegistry.findDefinitions()).thenReturn(moduleDefinitions);
		when(moduleRegistry.findDefinition("job_4_with_resource", ModuleType.job)).thenReturn(moduleDefinition);

	}
Tests REST compliance of module-related endpoints.

@author Glenn Renfro
@author Mark Fisher
@author Gunnar Hillert
@author Ilayaperumal Gopinathan
spring-xd-dirt/src/test/java/org/springframework/xd/dirt/rest/ModulesControllerIntegrationTests.java