You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NewInstanceExecutorTest.java 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package com.uqac.rthoni.java_rmi.server.executors;
  2. import com.uqac.rthoni.java_rmi.common.Command;
  3. import com.uqac.rthoni.java_rmi.server.ServerApplication;
  4. import org.junit.Test;
  5. import java.util.Arrays;
  6. import static org.junit.Assert.*;
  7. /**
  8. * Created by robin on 9/16/16.
  9. */
  10. public class NewInstanceExecutorTest extends AbstractTest {
  11. @Test
  12. public void test1() throws Exception
  13. {
  14. ServerApplication app = getServer();
  15. String res = runCommand(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test");
  16. assertNull(res);
  17. Object obj = app.getObject("test");
  18. assertNotNull(obj);
  19. assertEquals(obj.toString(), "privateString=default_value, privateInt=24, publicInt=42, aPrivateField=0, publicFloat=0.420000, publicDouble=0.125000, publicBool=true");
  20. }
  21. @Test
  22. public void test2() throws Exception
  23. {
  24. ServerApplication app = getServer();
  25. String res = runCommand(app, "creation#java.lang.String#mystr");
  26. assertNull(res);
  27. Object obj = app.getObject("mystr");
  28. assertNotNull(obj);
  29. assertEquals(obj.toString(), "");
  30. }
  31. @Test(expected = ClassNotFoundException.class)
  32. public void test3() throws Exception
  33. {
  34. ServerApplication app = getServer();
  35. runCommand(app, "creation#not_existing_class#myobj");
  36. }
  37. }