/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. package org.sigmah.server.endpoint.gwtrpc;
  6. import com.extjs.gxt.ui.client.Style;
  7. import com.extjs.gxt.ui.client.data.SortInfo;
  8. import junit.framework.Assert;
  9. import org.junit.Test;
  10. import org.junit.runner.RunWith;
  11. import org.sigmah.server.dao.OnDataSet;
  12. import org.sigmah.shared.command.GetInvitationList;
  13. import org.sigmah.shared.command.result.InvitationList;
  14. import org.sigmah.test.InjectionSupport;
  15. @RunWith(InjectionSupport.class)
  16. public class InvitationTest extends CommandTestCase {
  17. @Test
  18. @OnDataSet("/dbunit/schema1.db.xml")
  19. public void testGetList() throws Exception {
  20. GetInvitationList cmd = new GetInvitationList(1);
  21. cmd.setSortInfo(new SortInfo("userName", Style.SortDir.ASC));
  22. InvitationList list = execute(cmd);
  23. Assert.assertEquals("rows", 3, list.getData().size());
  24. Assert.assertEquals("Alex", list.getData().get(0).getUserName());
  25. Assert.assertEquals("Bavon", list.getData().get(1).getUserName());
  26. Assert.assertEquals("Stefan", list.getData().get(2).getUserName());
  27. Assert.assertTrue("alex is subscribed", list.getData().get(0).isSubscribed());
  28. Assert.assertFalse("bavon is not subscribed", list.getData().get(1).isSubscribed());
  29. }
  30. }