### Question:
PredefinedSource implements SocialSource { @Override public SocialQueryResult search(SocialQuery query) throws Exception { CustomSocialQueryResult res = new CustomSocialQueryResult(); res.setMessages(messages); return res; } PredefinedSource();  PredefinedSource(String file);  PredefinedSource(List<SocialMessage> messages); @Override SocialQueryResult search(SocialQuery query); void setMessages(List<SocialMessage> messages); @Override void setOAuthConsumer(String key, String secret); @Override void setOAuthAccessToken(String accessToken, String tokenSecret);  }### Answer:
@Test public void test_predefinedSource() throws Exception { PredefinedSource source = new PredefinedSource("/test_messages.json"); SocialQueryResult my_query = source.search(new SocialQuery("my query")); SocialMessage socialMessage = my_query.getMessages().get(0); Assert.assertEquals(socialMessage.getText(),"Hello"); }
@Test public void test_customSource_dataset() throws Exception { PredefinedSource source = new PredefinedSource(); SocialQueryResult my_query = source.search(new SocialQuery("my query")); SocialMessage socialMessage = my_query.getMessages().get(0); Assert.assertTrue(my_query.getMessages().size()>0); }