public List<AppStoreEntry> getRecommendedApps() {
    List<AppStoreEntry> apps = new ArrayList<AppStoreEntry>();
    SolrClient solr = getSolrClient();
    SolrQuery query = new SolrQuery();
    query.setQuery("*:*");
    query.setSort("download_i", ORDER.desc);
    query.setFilterQueries("type_s:AppStoreEntry");
    query.setRows(40);
    QueryResponse response;
    try {
      response = solr.query(query);
      Iterator<SolrDocument> list = response.getResults().listIterator();
      while (list.hasNext()) {
        SolrDocument d = list.next();
        AppStoreEntry entry = new AppStoreEntry();
        entry.setId(d.get("id").toString());
        entry.setOrg(d.get("org_s").toString());
        entry.setName(d.get("name_s").toString());
        entry.setDesc(d.get("desc_s").toString());
        if (d.get("icon_s")!=null) {
          entry.setIcon(d.get("icon_s").toString());
        }
        entry.setLike(Integer.parseInt(d.get("like_i").toString()));
        entry.setDownload(Integer.parseInt(d.get("download_i").toString()));
        apps.add(entry);
      }
    } catch (SolrServerException | IOException e) {
      LOG.error("Error getting a list of recommended applications: ", e);
    }
    return apps;
  }
@Test
  void testGetRecommendedApps() throws Exception {
    AppStoreEntry example = new AppStoreEntry();
    example.setOrg("jenkins-ci.org");
    example.setName("jenkins");
    example.setDesc("World leading open source automation system.");
    example.setIcon("/css/img/feather.png");
    example.setDownload(100);
    spy.register(example);
    AppStoreEntry example2 = new AppStoreEntry();
    example2.setOrg("Apache");
    example2.setName("httpd");
    example2.setDesc("Apache webserver");
    example2.setIcon("/css/img/feather.png");
    example2.setDownload(1);
    spy.register(example2);
    List<AppStoreEntry> actual = spy.getRecommendedApps();
    long previous = 1000L;
    for (AppStoreEntry app : actual) {
      assertTrue(previous > app.getDownload(),
          "Recommend app is not sort by download count.");
      previous = app.getDownload();
    }
  }