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.

ReadExecutorTest.java 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package com.uqac.rthoni.java_rmi.server.executors;
  2. import com.uqac.rthoni.java_rmi.server.ServerApplication;
  3. import org.junit.Assert;
  4. import org.junit.Test;
  5. /**
  6. * Created by robin on 9/16/16.
  7. */
  8. public class ReadExecutorTest 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. "lecture#test#publicInt");
  15. Assert.assertEquals("42", 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. "lecture#test#privateInt");
  23. Assert.assertEquals("24", 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. "lecture#test#privateString");
  31. Assert.assertEquals("default_value", res);
  32. }
  33. @Test(expected = NoSuchMethodException.class)
  34. public void test4() throws Exception
  35. {
  36. ServerApplication app = getServer();
  37. runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
  38. "lecture#test#aPrivateField");
  39. }
  40. @Test(expected = NullPointerException.class)
  41. public void test5() throws Exception
  42. {
  43. ServerApplication app = getServer();
  44. runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
  45. "lecture#test2#privateString");
  46. }
  47. @Test
  48. public void test6() throws Exception
  49. {
  50. ServerApplication app = getServer();
  51. String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
  52. "lecture#test#publicFloat");
  53. Assert.assertEquals("0.42", res);
  54. }
  55. @Test
  56. public void test7() throws Exception
  57. {
  58. ServerApplication app = getServer();
  59. String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
  60. "lecture#test#publicDouble");
  61. Assert.assertEquals("0.125", res);
  62. }
  63. @Test
  64. public void test8() throws Exception
  65. {
  66. ServerApplication app = getServer();
  67. String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
  68. "lecture#test#publicBool");
  69. Assert.assertEquals("true", res);
  70. }
  71. }