@Test
  public void readTest() throws Exception {
    ItemEntityGenerator response = new ItemEntityGenerator();
    response.addItem("title", "torrentUrl", Long.MAX_VALUE, 1, 1000);

    stubFor(
        get(urlEqualTo("/?type=search&search=title"))
            .willReturn(
                aResponse()
                    .withStatus(200)
                    .withHeader("Content-Type", "application/xml")
                    .withBody(response.toString())));

    dao.setClient(client);
    dao.setMediaType(MediaType.APPLICATION_XML_TYPE);
    dao.setBaseUri(new URI("http://localhost:8089"));

    List<FeedResult> results = dao.read("title");
    Assert.assertNotNull(results);
    Assert.assertEquals(1, results.size());
    Assert.assertEquals("title", results.get(0).getTitle());
    Assert.assertEquals("torrentUrl", results.get(0).getTorrentURL());
    Assert.assertEquals(Long.MAX_VALUE, results.get(0).getContentLength());
    Assert.assertEquals(1, results.get(0).getSeeders());
    Assert.assertEquals(1000, results.get(0).getLeechers());
  }
 @Test
 public void baseUriTest() throws Exception {
   Assert.assertNull(dao.getBaseUri());
   URI uri = new URI("http://test.com");
   dao.setBaseUri(uri);
   Assert.assertEquals(uri, dao.getBaseUri());
 }
  @Test(expected = FeedException.class)
  public void readWebAppExceptionTest() throws Exception {

    stubFor(
        get(urlEqualTo("/?type=search&search=title"))
            .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "application/xml")));

    dao.setMediaType(MediaType.APPLICATION_XML_TYPE);
    dao.setBaseUri(new URI("http://localhost:8089"));
    dao.setClient(client);

    dao.read("title");
    Assert.fail();
  }