@Test
  public void testRemoveSpecies() throws AWNoSuchEntityException {
    mSpeciesDao.updateIsDeleted(SPECIES_ONE_ID, true);
    Species species = mSpeciesDao.getSpecies(SPECIES_ONE_ID);

    Assert.assertNotEquals(species.isDeleted(), false);
    mSpeciesDao.updateIsDeleted(SPECIES_ONE_ID, false);
  }
  @Test
  public void testGetSourcesLikePagedNoOffset() {
    List<Species> allSpecies = mSpeciesDao.getSpeciesLike(SPECIES_LIKE_TERM, null, null);
    List<Species> pagedSpecies =
        mSpeciesDao.getSpeciesLike(SPECIES_LIKE_TERM, null, TestConstants.TEST_LIMIT);

    PageTestAsserter.assertPagedNoOffset(allSpecies, pagedSpecies);
  }
  @Test
  public void testGetSpeciesLikePagedNoLimit() {
    List<Species> allSpecies = mSpeciesDao.getSpeciesLike(SPECIES_LIKE_TERM, null, null);
    List<Species> pagedSpecies =
        mSpeciesDao.getSpeciesLike(SPECIES_LIKE_TERM, TestConstants.TEST_OFFSET, null);

    PageTestAsserter.assertPagedNoLimit(allSpecies, pagedSpecies);
  }
 @Test
 public void testUpdateSpecies() throws AWNoSuchEntityException, AWNonUniqueException {
   Species species = mSpeciesDao.getSpecies(SPECIES_ONE_ID);
   species.setName(SPECIES_ONE_NEW_NAME);
   species = mSpeciesDao.store(species);
   Assert.assertNotEquals(SPECIES_ONE_NAME, species.getName());
   species.setName(SPECIES_ONE_NAME);
   mSpeciesDao.store(species);
 }
  @Test
  public void testStoreValidSpecies() throws AWNonUniqueException {
    Species species = new Species();
    species.setName(SPECIES_FOUR_NAME);
    species = mSpeciesDao.store(species);

    Assert.assertNotEquals(TestConstants.NON_PERSISTED_ID, species.getId());
    deleteSpecies(species);
  }
 @Test(expectedExceptions = {AWNonUniqueException.class})
 public void testStoreNonUniqueSpecies() throws AWNonUniqueException {
   Species species = new Species();
   species.setName(SPECIES_ONE_NAME);
   mSpeciesDao.store(species);
 }
 private void deleteSpecies(Species species) {
   if (species.getId() != null) {
     mSpeciesDao.realDelete(species.getId());
   }
 }
 @Test
 public void testGetSpeciesLike() {
   List<Species> species = mSpeciesDao.getSpeciesLike(SPECIES_LIKE_TERM, null, null);
   Assert.assertEquals(species.size(), EXPECTED_SPECIES_LIKE);
 }