Package org.easycassandra.bean

Source Code of org.easycassandra.bean.PictureDAOTest

package org.easycassandra.bean;

import java.util.Random;

import junit.framework.Assert;

import org.easycassandra.bean.dao.PersistenceDao;
import org.easycassandra.bean.model.Picture;
import org.easycassandra.bean.model.Picture.Details;
import org.junit.Test;
/**
* the PictureDAO test.
* @author otaviojava
*/
public class PictureDAOTest {

    private static final int SIZE = 200;
    private PersistenceDao<Picture, String> dao = new PersistenceDao<Picture, String>(
            Picture.class);
    /**
     * run the test.
     */
    @Test
    public void insertTest() {
        Picture picture = new Picture();
        picture.setDetail(new Details());
        picture.setName("mypicture");
        picture.getDetail().setFileName("otavio.png");
        byte[] file = new byte[SIZE];
        new Random().nextBytes(file);
        picture.getDetail().setContents(file);
        Assert.assertTrue(dao.insert(picture));

    }
    /**
     * run the test.
     */
    @Test
    public void retrieveTest() {
        Picture picture = dao.retrieve("mypicture");
        Assert.assertNotNull(picture);
    }
}
TOP

Related Classes of org.easycassandra.bean.PictureDAOTest

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.