Subversion Repositories eFlore/Applications.del

Rev

Rev 1503 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package org.tela_botanica.del.test.modeles;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;

import org.junit.Test;
import org.tela_botanica.del.client.modeles.MoyenneVote;
import org.tela_botanica.del.client.modeles.Observation;
import org.tela_botanica.del.client.modeles.PropositionDetermination;

public class MoyenneVoteTest {

        @Test
        public void testCompareTo() {
                
                PropositionDetermination propositionDetermination = new PropositionDetermination(new Observation());
                MoyenneVote mv1 = new MoyenneVote(100, propositionDetermination);
                
                PropositionDetermination propositionDetermination2 = new PropositionDetermination(new Observation());
                MoyenneVote mv2 = new MoyenneVote(75, propositionDetermination2);
                
                PropositionDetermination propositionDetermination3 = new PropositionDetermination(new Observation());
                MoyenneVote mv3 = new MoyenneVote(50, propositionDetermination3);
                
                PropositionDetermination propositionDetermination4 = new PropositionDetermination(new Observation());
                MoyenneVote mv4 = new MoyenneVote(50, propositionDetermination4);
                
                int mv1SuperieurMv2 = mv1.compareTo(mv2);
                assertEquals(-1, mv1SuperieurMv2);
                
                int mv3InferieurMv2 = mv3.compareTo(mv2);
                assertEquals(1, mv3InferieurMv2);
                
                int mv4EgalMv3 = mv4.compareTo(mv3);
                assertEquals(0, mv4EgalMv3);
        }

}