コード例 #1
0
  @Test(dependsOnMethods = {"TestConstructor", "TestAppid"})
  public void buildQueryResult() {
    AzureSearchCompositeQuery aq = new AzureSearchCompositeQuery();
    aq.setAppid(AzureAppid.AZURE_APPID);
    aq.setQuery("Oklahoma Sooners");
    aq.setCategory("rt_Sports");
    aq.setLocationOverride("US.OK");
    aq.setSortBy("Date");
    aq.setSources(
        new AZURESEARCH_QUERYTYPE[] {
          AZURESEARCH_QUERYTYPE.WEB,
          AZURESEARCH_QUERYTYPE.NEWS,
          AZURESEARCH_QUERYTYPE.IMAGE,
          AZURESEARCH_QUERYTYPE.VIDEO
        });

    logURL(aq);

    aq.doQuery();
    Document ad = aq.getRawResult();
    Assert.assertNotNull(ad);

    ars = aq.getQueryResult();
    Assert.assertNotNull(ars, "getQueryResult returned null");
    Assert.assertNotNull(ars.getASRs(), "getQueryResult.getASRs returned null");
    Assert.assertFalse(ars.getASRs().isEmpty(), "getQueryResult returned no results");

    asr = ars.getASRs().get(0);
    Assert.assertNotNull(asr, "Unparseable result from result.");
  }
コード例 #2
0
 @Test(dependsOnMethods = "buildQueryResult")
 public void getVideoTotal() {
   Assert.assertNotNull(ars.getVideoTotal(), "Unparseable VideoTotal from result");
   Assert.assertTrue(ars.getVideoTotal() > 0, "Wrong VideoTotal from result");
 }