@Test
	public void testSplitterUsesIterator() throws Exception {
		System.out.println(System.getProperty("user.dir"));
		ConfigurableApplicationContext ctx = new FileSystemXmlApplicationContext(new String[] {
			"../modules/common/file-source-common-context.xml",
			"classpath:org/springframework/xd/dirt/stream/ppc-context.xml" }, false);
		StandardEnvironment env = new StandardEnvironment();
		Properties props = new Properties();
		props.setProperty("fixedDelay", "5");
		props.setProperty("timeUnit", "SECONDS");
		props.setProperty("initialDelay", "0");
		props.setProperty("withMarkers", "false");
		PropertiesPropertySource pps = new PropertiesPropertySource("props", props);
		env.getPropertySources().addLast(pps);
		env.setActiveProfiles("use-contents-with-split");
		ctx.setEnvironment(env);
		ctx.refresh();
		FileSplitter splitter = ctx.getBean(FileSplitter.class);
		File foo = File.createTempFile("foo", ".txt");
		final AtomicReference<Method> splitMessage = new AtomicReference<>();
		ReflectionUtils.doWithMethods(FileSplitter.class, new MethodCallback() {

			@Override
			public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
				method.setAccessible(true);
				splitMessage.set(method);
			}
		}, new MethodFilter() {

			@Override
			public boolean matches(Method method) {
				return method.getName().equals("splitMessage");
			}
		});
		Object result = splitMessage.get().invoke(splitter, new GenericMessage<File>(foo));
		assertThat(result, instanceOf(Iterator.class));
		ctx.close();
		foo.delete();
	}
@author David Turanski
@author Gunnar Hillert
@author Gary Russell
spring-xd-dirt/src/test/java/org/springframework/xd/dirt/stream/FileSourceModuleTests.java