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.

ConfigTargetTest.java 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * Copyright (c) 2006-2008 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.config;
  23. import org.junit.Test;
  24. import static org.junit.Assert.*;
  25. public class ConfigTargetTest extends junit.framework.TestCase {
  26. @Test
  27. public void testDefault() {
  28. final ConfigTarget target = new ConfigTarget();
  29. assertEquals(target.getType(), ConfigTarget.TYPE.GLOBAL);
  30. }
  31. @Test
  32. public void testSetGlobal() {
  33. final ConfigTarget target = new ConfigTarget();
  34. target.setGlobal();
  35. assertEquals(target.getType(), ConfigTarget.TYPE.GLOBAL);
  36. assertEquals(target.getTypeName(), "global");
  37. }
  38. @Test
  39. public void testSetGlobalDefault() {
  40. final ConfigTarget target = new ConfigTarget();
  41. target.setGlobalDefault();
  42. assertEquals(target.getType(), ConfigTarget.TYPE.GLOBALDEFAULT);
  43. assertEquals(target.getTypeName(), "globaldefault");
  44. }
  45. @Test
  46. public void testSetTheme() {
  47. final ConfigTarget target = new ConfigTarget();
  48. target.setTheme();
  49. assertEquals(target.getType(), ConfigTarget.TYPE.THEME);
  50. assertEquals(target.getTypeName(), "theme");
  51. }
  52. @Test
  53. public void testSetProfile() {
  54. final ConfigTarget target = new ConfigTarget();
  55. target.setProfile();
  56. assertEquals(target.getType(), ConfigTarget.TYPE.PROFILE);
  57. assertEquals(target.getTypeName(), "profile");
  58. }
  59. @Test
  60. public void testSetIrcd() {
  61. final ConfigTarget target = new ConfigTarget();
  62. target.setIrcd("ircd_name");
  63. assertEquals(target.getType(), ConfigTarget.TYPE.IRCD);
  64. assertEquals(target.getTypeName(), "ircd");
  65. assertEquals(target.getData(), "ircd_name");
  66. }
  67. @Test
  68. public void testSetNetwork() {
  69. final ConfigTarget target = new ConfigTarget();
  70. target.setNetwork("net_name");
  71. assertEquals(target.getType(), ConfigTarget.TYPE.NETWORK);
  72. assertEquals(target.getTypeName(), "network");
  73. assertEquals(target.getData(), "net_name");
  74. }
  75. @Test
  76. public void testSetServer() {
  77. final ConfigTarget target = new ConfigTarget();
  78. target.setServer("server_name");
  79. assertEquals(target.getType(), ConfigTarget.TYPE.SERVER);
  80. assertEquals(target.getTypeName(), "server");
  81. assertEquals(target.getData(), "server_name");
  82. }
  83. @Test
  84. public void testSetChannel() {
  85. final ConfigTarget target = new ConfigTarget();
  86. target.setChannel("channel_name");
  87. assertEquals(target.getType(), ConfigTarget.TYPE.CHANNEL);
  88. assertEquals(target.getTypeName(), "channel");
  89. assertEquals(target.getData(), "channel_name");
  90. }
  91. }