Package fr.iut.montreuil

Source Code of fr.iut.montreuil.TestMediaDao

package fr.iut.montreuil;

import java.util.Collection;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;

import fr.iut.montreuil.dao.MediaDao;
import fr.iut.montreuil.model.Media;

public class TestMediaDao
{
  private MediaDao dao ;
 
  @Before
  public void setup()
  {
    dao = new MediaDao();
  }
 
 
  @Test
  public void list()
  {
    Collection<Media>medias = dao.findAll();
   
    Assert.assertNotNull(medias);
    Assert.assertEquals(0,medias.size());
  }
 
 
  @Test
  public void addElement()
  {
    dao.add(new Media());
   
    Collection<Media>medias = dao.findAll();
   
    Assert.assertNotNull(medias);
    Assert.assertEquals(1,medias.size());
  }
 
  @Test
  public void removeElement()
  {
    dao.add(new Media("Autant en emporte le vent"));
   
    Collection<Media>medias = dao.findAll();
    Assert.assertEquals(1,medias.size());
   
    dao.removeByName("Autant en emporte le vent");
   
    medias = dao.findAll();
   
    Assert.assertNotNull(medias);
    Assert.assertEquals(0,medias.size());
  }

}
TOP

Related Classes of fr.iut.montreuil.TestMediaDao

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.