PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/sigmah/src/test/java/org/sigmah/server/endpoint/gwtrpc/InvitationTest.java

http://sigma-h.googlecode.com/
Java | 38 lines | 26 code | 8 blank | 4 comment | 0 complexity | 0bfbd29f7d6a9a118b4f28ef762cffb9 MD5 | raw file
 1/*
 2 * All Sigmah code is released under the GNU General Public License v3
 3 * See COPYRIGHT.txt and LICENSE.txt.
 4 */
 5
 6package org.sigmah.server.endpoint.gwtrpc;
 7
 8import com.extjs.gxt.ui.client.Style;
 9import com.extjs.gxt.ui.client.data.SortInfo;
10import junit.framework.Assert;
11import org.junit.Test;
12import org.junit.runner.RunWith;
13import org.sigmah.server.dao.OnDataSet;
14import org.sigmah.shared.command.GetInvitationList;
15import org.sigmah.shared.command.result.InvitationList;
16import org.sigmah.test.InjectionSupport;
17
18@RunWith(InjectionSupport.class)
19public class InvitationTest extends CommandTestCase {
20
21    @Test
22    @OnDataSet("/dbunit/schema1.db.xml")
23    public void testGetList() throws Exception {
24        GetInvitationList cmd = new GetInvitationList(1);
25        cmd.setSortInfo(new SortInfo("userName", Style.SortDir.ASC));
26
27        InvitationList list = execute(cmd);
28
29        Assert.assertEquals("rows", 3, list.getData().size());
30
31        Assert.assertEquals("Alex", list.getData().get(0).getUserName());
32        Assert.assertEquals("Bavon", list.getData().get(1).getUserName());
33        Assert.assertEquals("Stefan", list.getData().get(2).getUserName());
34
35        Assert.assertTrue("alex is subscribed", list.getData().get(0).isSubscribed());
36        Assert.assertFalse("bavon is not subscribed", list.getData().get(1).isSubscribed());
37    }
38}