コード例 #1
0
 @Test
 public void totalMatchesParse() throws IOException {
   int testMatches = 261356;
   String s =
       "http://api.yummly.com/v1/api/recipes?_app_id=95a21eb2&_app_key=d703fa9e11ee34f104bc271ec3bbcdb9&q=garlic";
   RecipeSummaryList r = new RecipeSummaryList();
   r = JSONProcessor.parseRecipes(s);
   assertEquals(r.getTotalMatches(), testMatches);
 }
コード例 #2
0
 @Test
 public void logoParse() throws IOException {
   String testLogo = "http://static.yummly.com/api-logo.png";
   String s =
       "http://api.yummly.com/v1/api/recipes?_app_id=95a21eb2&_app_key=d703fa9e11ee34f104bc271ec3bbcdb9&q=garlic";
   RecipeSummaryList r = new RecipeSummaryList();
   r = JSONProcessor.parseRecipes(s);
   assertEquals(r.getLogo(), testLogo);
 }
コード例 #3
0
 @Test
 public void urlParse() throws IOException {
   String testUrl = "http://www.yummly.com/recipes/";
   String s =
       "http://api.yummly.com/v1/api/recipes?_app_id=95a21eb2&_app_key=d703fa9e11ee34f104bc271ec3bbcdb9&";
   RecipeSummaryList r = new RecipeSummaryList();
   r = JSONProcessor.parseRecipes(s);
   assertEquals(r.getUrl(), testUrl);
 }
コード例 #4
0
 @Test
 public void textParse() throws IOException {
   String testText = "Recipe search powered by Yummly";
   String s =
       "http://api.yummly.com/v1/api/recipes?_app_id=95a21eb2&_app_key=d703fa9e11ee34f104bc271ec3bbcdb9&q=garlic";
   RecipeSummaryList r = new RecipeSummaryList();
   r = JSONProcessor.parseRecipes(s);
   assertEquals(r.getText(), testText);
 }
コード例 #5
0
 @Test
 public void htmlParse() throws IOException {
   String testHtml =
       "Recipe search powered by <a href='http://www.yummly.com/recipes'><img alt='Yummly' src='http://static.yummly.com/api-logo.png'/></a>";
   String s =
       "http://api.yummly.com/v1/api/recipes?_app_id=95a21eb2&_app_key=d703fa9e11ee34f104bc271ec3bbcdb9&";
   RecipeSummaryList r = new RecipeSummaryList();
   r = JSONProcessor.parseRecipes(s);
   assertEquals(r.getHtml(), testHtml);
 }