@Test
  public void getUnreadDrops() {
    Account account = accountDao.findById(3L);

    DropFilter filter = new DropFilter();
    filter.setRead(false);
    List<Drop> drops = riverDao.getDrops(1L, filter, 1, 10, account);

    assertEquals(3, drops.size());

    Drop drop = drops.get(1);
    assertEquals(3, drop.getId());
  }
  @Test
  public void getDropsToDate() throws Exception {
    Account account = accountDao.findById(1L);

    DropFilter filter = new DropFilter();
    filter.setDateTo(dateFormat.parse("01/01/2012"));
    List<Drop> drops = riverDao.getDrops(1L, filter, 1, 10, account);

    assertEquals(1, drops.size());

    Drop drop = drops.get(0);
    assertEquals(1, drop.getId());
  }
  @Test
  public void getReadDropsSince() {
    Account account = accountDao.findById(3L);

    DropFilter filter = new DropFilter();
    filter.setRead(true);
    filter.setSinceId(3L);
    List<Drop> drops = riverDao.getDrops(1L, filter, 1, 10, account);

    assertEquals(1, drops.size());

    Drop drop = drops.get(0);
    assertEquals(5, drop.getId());
  }
  @Test
  public void getDropsForChannelId() {
    Account account = accountDao.findById(1L);

    ArrayList<Long> channels = new ArrayList<Long>();
    channels.add(1L);
    DropFilter filter = new DropFilter();
    filter.setChannelIds(channels);
    List<Drop> drops = riverDao.getDrops(1L, filter, 1, 10, account);

    assertEquals(2, drops.size());

    Drop drop = drops.get(0);
    assertEquals(3, drop.getId());
  }
  @Test
  public void getDropsSinceForChannelName() {
    Account account = accountDao.findById(3L);

    List<String> channels = new ArrayList<String>();
    channels.add("twitter");
    DropFilter filter = new DropFilter();
    filter.setChannels(channels);
    filter.setSinceId(3L);
    List<Drop> drops = riverDao.getDrops(1L, filter, 1, 10, account);

    assertEquals(1, drops.size());

    Drop drop = drops.get(0);
    assertTrue(drop.getId() > 3);
  }
  @Test
  public void getDrops() {
    Account account = accountDao.findById(1L);
    DropFilter filter = new DropFilter();
    List<Drop> drops = riverDao.getDrops(1L, filter, 1, 10, account);

    assertEquals(5, drops.size());

    Drop drop = drops.get(0);
    assertEquals(5, drop.getId());
    assertEquals(false, drop.getRead());
    assertEquals("rss", drop.getChannel());
    assertEquals("droplet 5 title", drop.getTitle());
    assertEquals("droplet 5 content", drop.getContent());
    assertEquals("5", drop.getOriginalId());
    assertEquals(30, drop.getCommentCount());
    assertEquals(1, drop.getIdentity().getId());
    assertEquals("identity1_name", drop.getIdentity().getName());
    assertEquals("identity1_avatar", drop.getIdentity().getAvatar());
    assertNotNull(drop.getOriginalUrl());
    assertEquals(3, drop.getOriginalUrl().getId());
    assertEquals("http://www.bbc.co.uk/nature/20273855", drop.getOriginalUrl().getUrl());

    assertEquals(2, drop.getTags().size());
    Tag tag = drop.getTags().get(0);
    assertEquals(1, tag.getId());
    assertEquals("Jeremy Hunt", tag.getTag());
    assertEquals("person", tag.getType());

    assertEquals(2, drop.getLinks().size());
    Link link = drop.getLinks().get(0);
    assertEquals(2, link.getId());
    assertEquals(
        "http://news.bbc.co.uk/democracylive/hi/house_of_commons/newsid_9769000/9769109.stm#sa-ns_mchannel=rss&amp;ns_source=PublicRSS20-sa&quot;",
        link.getUrl());

    assertEquals(2, drop.getMedia().size());
    Media media = drop.getMedia().get(0);
    assertEquals(1, media.getId());
    assertEquals(
        "http://gigaom2.files.wordpress.com/2012/10/datacapspercentage.jpeg", media.getUrl());
    assertEquals("image", media.getType());

    assertEquals(2, media.getThumbnails().size());
    MediaThumbnail thumbnail = media.getThumbnails().get(0);
    assertEquals(
        "https://2bcbd22fbb0a02d76141-1680e9dfed1be27cdc47787ec5d4ef89.ssl.cf1.rackcdn.com/625dd7cb656d258b4effb325253e880631699d80345016e9e755b4a04341cda1.peg",
        thumbnail.getUrl());
    assertEquals(80, thumbnail.getSize());

    assertEquals(2, drop.getPlaces().size());
    Place place = drop.getPlaces().get(0);
    assertEquals(1, place.getId());
    assertEquals("Wales", place.getPlaceName());
    assertEquals(new Float(146.11), place.getLongitude());
    assertEquals(new Float(-33), place.getLatitude());

    drop = drops.get(3);
    assertEquals(2, drop.getId());
    assertEquals(2, drop.getForms().size());

    RiverDropForm form = (RiverDropForm) drop.getForms().get(0);
    assertEquals(1, (long) form.getId());
    List<RiverDropFormField> values = form.getValues();
    assertEquals(3, values.size());
    assertEquals(1, (long) values.get(0).getField().getId());
    assertEquals("[\"English\"]", values.get(0).getValue());
    assertEquals(2, (long) values.get(1).getField().getId());
    assertEquals("\"Journalist\"", values.get(1).getValue());
    assertEquals(3, (long) values.get(2).getField().getId());
    assertEquals("\"Kenyans\"", values.get(2).getValue());
  }
  @Test
  public void getDropsSince() {
    Account account = accountDao.findById(1L);
    DropFilter filter = new DropFilter();
    filter.setSinceId(3L);
    List<Drop> drops = riverDao.getDrops(1L, filter, 1, 1, account);

    assertEquals(1, drops.size());

    Drop drop = drops.get(0);
    assertTrue(drop.getId() > 3);
    assertEquals(false, drop.getRead());
    assertEquals("twitter", drop.getChannel());
    assertEquals("droplet 4 title", drop.getTitle());
    assertEquals("droplet 4 content", drop.getContent());
    assertEquals("4", drop.getOriginalId());
    assertEquals(25, drop.getCommentCount());
    assertEquals(2, drop.getIdentity().getId());
    assertEquals("identity2_name", drop.getIdentity().getName());
    assertEquals("identity2_avatar", drop.getIdentity().getAvatar());
    assertNotNull(drop.getOriginalUrl());
    assertEquals(3, drop.getOriginalUrl().getId());
    assertEquals("http://www.bbc.co.uk/nature/20273855", drop.getOriginalUrl().getUrl());

    assertEquals(1, drop.getTags().size());
    Tag tag = drop.getTags().get(0);
    assertEquals(1, tag.getId());
    assertEquals("Jeremy Hunt", tag.getTag());
    assertEquals("person", tag.getType());

    assertEquals(1, drop.getLinks().size());
    Link link = drop.getLinks().get(0);
    assertEquals(10, link.getId());
    assertEquals("http://www.bbc.co.uk/sport/0/football/20319573", link.getUrl());

    assertEquals(1, drop.getMedia().size());
    Media media = drop.getMedia().get(0);
    assertEquals(1, media.getId());
    assertEquals(
        "http://gigaom2.files.wordpress.com/2012/10/datacapspercentage.jpeg", media.getUrl());
    assertEquals("image", media.getType());

    assertEquals(2, media.getThumbnails().size());
    MediaThumbnail thumbnail = media.getThumbnails().get(0);
    assertEquals(
        "https://2bcbd22fbb0a02d76141-1680e9dfed1be27cdc47787ec5d4ef89.ssl.cf1.rackcdn.com/625dd7cb656d258b4effb325253e880631699d80345016e9e755b4a04341cda1.peg",
        thumbnail.getUrl());
    assertEquals(80, thumbnail.getSize());

    assertEquals(1, drop.getPlaces().size());
    Place place = drop.getPlaces().get(0);
    assertEquals(1, place.getId());
    assertEquals("Wales", place.getPlaceName());
    assertEquals(new Float(146.11), place.getLongitude());
    assertEquals(new Float(-33), place.getLatitude());
  }