Package models.activity

Source Code of models.activity.NewVoteActivityTest

package models.activity;

import models.LightningTalk;
import models.Vote;
import org.junit.*;

/**
* Unit tests for {@link NewVoteActivity} domain object
* @author Sryl <cyril.lacote@gmail.com>
*/
public class NewVoteActivityTest extends AbstractActivityTest {
   
    @Test
    public void vote() {
       
        LightningTalk lt = createLightningTalk("test");
       
        // No activity for the talk
        assertEquals(0, Activity.count("session = ?", lt));
        assertNull(Activity.find("session = ?", lt).first());
       
        // new negative vote pour the lt
        Vote v = new Vote(lt, member, false).save();
       
        // Stille no activity for the talk
        assertEquals(0, Activity.count("session = ?", lt));
        assertNull(Activity.find("session = ?", lt).first());
       
        // Positive vote
        v.value = true;
        v.save();
       
        // One activity for the session
        assertEquals(1, Activity.count("session = ?", lt));
        Activity a = Activity.find("session = ?", lt).first();
        assertActivity(a);
        assertTrue(a instanceof NewVoteActivity);
        NewVoteActivity nva = (NewVoteActivity) a;
        assertEquals(lt, nva.session);
        assertEquals(member, nva.member);
    }
}
TOP

Related Classes of models.activity.NewVoteActivityTest

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.