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.

MethodExecutorTest.java 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package com.uqac.rthoni.java_rmi.server.executors;
  2. import com.uqac.rthoni.java_rmi.server.ServerApplication;
  3. import org.junit.Test;
  4. import static org.junit.Assert.*;
  5. /**
  6. * Created by robin on 9/16/16.
  7. */
  8. public class MethodExecutorTest extends AbstractTest {
  9. @Test
  10. public void test1() throws Exception
  11. {
  12. ServerApplication app = getServer();
  13. String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
  14. "fonction#test#getMyself#java.lang.String:a_value");
  15. assertEquals("a_value", res);
  16. }
  17. @Test
  18. public void test2() throws Exception
  19. {
  20. ServerApplication app = getServer();
  21. String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
  22. "fonction#test#uselessMethod#int:42,int:24,java.lang.String:a_value");
  23. assertEquals("NULL", res);
  24. }
  25. @Test
  26. public void test3() throws Exception
  27. {
  28. ServerApplication app = getServer();
  29. String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
  30. "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test2",
  31. "ecriture#test#privateString#some_value",
  32. "fonction#test#getMyString#com.uqac.rthoni.java_rmi.server.executors.TestDbo:ID(test2)");
  33. assertEquals("some_value", res);
  34. }
  35. @Test
  36. public void test4() throws Exception
  37. {
  38. ServerApplication app = getServer();
  39. String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
  40. "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test2",
  41. "fonction#test#setPrivateString#java.lang.String:some_value",
  42. "fonction#test#getMyString#com.uqac.rthoni.java_rmi.server.executors.TestDbo:ID(test2)");
  43. assertEquals("NULL\nsome_value", res);
  44. }
  45. @Test
  46. public void test5() throws Exception
  47. {
  48. ServerApplication app = getServer();
  49. String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
  50. "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test2",
  51. "fonction#test#setPrivateString#java.lang.String:some_value",
  52. "fonction#test#getPrivateString");
  53. assertEquals("NULL\nsome_value", res);
  54. }
  55. }