Example #1
0
  /**
   * Test the situation where no campaigns are loaded in the system.
   *
   * @throws Exception when the bid JSON file fails to load or has a JSON error in it.
   */
  @Test
  public void testNoCampaigns() throws Exception {
    InputStream is = Configuration.getInputStream("SampleBids/nexage.txt");
    BidRequest request = new BidRequest(is);

    CampaignProcessor proc = new CampaignProcessor(null, request);
    SelectedCreative resp = proc.call();
    assertNull(resp);
  }
Example #2
0
  //	@Test
  public void testOneMatching() throws Exception {
    InputStream is = Configuration.getInputStream("SampleBids/nexage.txt");
    BidRequest request = new BidRequest(is);
    Configuration cf = Configuration.getInstance();
    cf.clear();
    cf.initialize("Campaigns/payday.json");
    Campaign c = cf.campaignsList.get(0);

    CampaignProcessor proc = new CampaignProcessor(c, request);
    SelectedCreative resp = proc.call();
    assertNotNull(resp);
    assertTrue(resp.getCreative().w == 320.0);
  }