@SuppressWarnings("unchecked") @Test @Ignore public void demoReceiveSearchResults() throws Exception { PropertiesFactoryBean pf = new PropertiesFactoryBean(); pf.setLocation(new ClassPathResource("sample.properties")); pf.afterPropertiesSet(); Properties prop = pf.getObject(); TwitterTemplate template = new TwitterTemplate( prop.getProperty("z_oleg.oauth.consumerKey"), prop.getProperty("z_oleg.oauth.consumerSecret"), prop.getProperty("z_oleg.oauth.accessToken"), prop.getProperty("z_oleg.oauth.accessTokenSecret")); SearchReceivingMessageSource tSource = new SearchReceivingMessageSource(template, "foo"); tSource.setQuery(SEARCH_QUERY); tSource.afterPropertiesSet(); for (int i = 0; i < 50; i++) { Message<Tweet> message = (Message<Tweet>) tSource.receive(); if (message != null) { Tweet tweet = message.getPayload(); logger.info(tweet.getFromUser() + " - " + tweet.getText() + " - " + tweet.getCreatedAt()); } } }