Package org.easycassandra.bean

Source Code of org.easycassandra.bean.AnimalDAOTest

package org.easycassandra.bean;

import org.easycassandra.KeyProblemsException;
import org.easycassandra.bean.dao.PersistenceDao;
import org.easycassandra.bean.model.Animal;
import org.junit.Assert;
import org.junit.Test;

/**
*
* @author otavio
*/
public class AnimalDAOTest {
    private PersistenceDao<Animal, String> dao = new PersistenceDao<Animal, String>(
            Animal.class);
    /**
     * run the test.
     */
    @Test
    public void insertErrorTest() {
        Animal animal = new Animal();
        animal.setName("Lion");
        animal.setRace("I know no");
        animal.setCountry("Brazil");
        Assert.assertTrue(dao.insert(animal));

    }
    /**
     * run the test.
     */
    @Test(expected = KeyProblemsException.class)
    public void insertNullError() {
        Animal animal = new Animal();
        animal.setRace("I know no");
        animal.setCountry("Brazil");
        Assert.assertFalse(dao.insert(animal));
    }
    /**
     * run the test.
     */
    @Test
    public void listErrorTest() {
        Assert.assertNotNull(dao.listAll());

    }
    /**
     * run the test.
     */
    @Test
    public void listIndexInitializeTest() {
        Assert.assertTrue(dao.listByIndex("country", "Brazil").size() >= 1);
    }

}
TOP

Related Classes of org.easycassandra.bean.AnimalDAOTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.