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.

ActionModelTest.java 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. * SOFTWARE.
  21. */
  22. package com.dmdirc.actions;
  23. import java.util.ArrayList;
  24. import java.util.List;
  25. import org.junit.Test;
  26. import static org.junit.Assert.*;
  27. public class ActionModelTest extends junit.framework.TestCase {
  28. /*@Test
  29. public void trigger() {
  30. }*/
  31. @Test
  32. public void testConditions() {
  33. final ActionModel model = new ActionModel("group", "name");
  34. assertTrue(model.getConditions().isEmpty());
  35. final List<ActionCondition> conds = new ArrayList<ActionCondition>();
  36. model.setConditions(conds);
  37. assertEquals(conds, model.getConditions());
  38. }
  39. @Test
  40. public void testTriggers() {
  41. final ActionModel model = new ActionModel("group", "name");
  42. assertNull(model.getTriggers());
  43. final ActionType[] triggers = {CoreActionType.CHANNEL_ACTION};
  44. model.setTriggers(triggers);
  45. assertEquals(triggers, model.getTriggers());
  46. }
  47. @Test
  48. public void testNewFormat() {
  49. final ActionModel model = new ActionModel("group", "name");
  50. assertNull(model.getNewFormat());
  51. model.setNewFormat("");
  52. assertEquals("", model.getNewFormat());
  53. model.setNewFormat("newformat");
  54. assertEquals("newformat", model.getNewFormat());
  55. }
  56. @Test
  57. public void testResponse() {
  58. final ActionModel model = new ActionModel("group", "name");
  59. assertNull(model.getResponse());
  60. final String[] newResponse = {"a", "b", "c"};
  61. model.setResponse(newResponse);
  62. assertEquals(newResponse, model.getResponse());
  63. }
  64. @Test
  65. public void testGroup() {
  66. final ActionModel model = new ActionModel("group", "name");
  67. assertEquals("group", model.getGroup());
  68. model.setGroup("group2");
  69. assertEquals("group2", model.getGroup());
  70. }
  71. @Test
  72. public void testName() {
  73. final ActionModel model = new ActionModel("group", "name");
  74. assertEquals("name", model.getName());
  75. model.setName("name2");
  76. assertEquals("name2", model.getName());
  77. }
  78. }