ConfigurationTest.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package de.tu_darmstadt.tk.shNetSimTests.control;
  2. import org.junit.Assert;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. import de.tu_darmstadt.tk.SmartHomeNetworkSim.control.SettingsController;
  6. import de.tu_darmstadt.tk.SmartHomeNetworkSim.control.Controller;
  7. import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Model;
  8. /**
  9. * Tests Configuration Controller
  10. *
  11. *
  12. * @author Andreas T. Meyer-Berg
  13. */
  14. public class ConfigurationTest {
  15. private Controller control;
  16. private Model model;
  17. private SettingsController config;
  18. @Before
  19. public void initialize() {
  20. model = new Model();
  21. control = new Controller(model);
  22. config = control.getSettingsController();
  23. }
  24. @Test
  25. public void testConfigurationManager() {
  26. Assert.assertEquals(model.getConfigurator(), control
  27. .getSettingsController().getConfigurationManager());
  28. Assert.assertNotNull(config);
  29. }
  30. @Test
  31. public void testShowConnectionsDefault() {
  32. Assert.assertTrue(config.isShowConnections());
  33. }
  34. @Test
  35. public void testShowConnections() {
  36. config.setShowConnections(false);
  37. Assert.assertFalse(config.isShowConnections());
  38. config.setShowConnections(true);
  39. Assert.assertTrue(config.isShowConnections());
  40. }
  41. @Test
  42. public void testShowLinksDefault() {
  43. Assert.assertTrue(config.isShowLinks());
  44. }
  45. @Test
  46. public void testShowLinks() {
  47. config.setShowLinks(false);
  48. Assert.assertFalse(config.isShowLinks());
  49. config.setShowLinks(true);
  50. Assert.assertTrue(config.isShowLinks());
  51. }
  52. @Test
  53. public void testShowSmartDevicesDefault() {
  54. Assert.assertTrue(config.isShowSmartDevices());
  55. }
  56. @Test
  57. public void testShowSmartDevices() {
  58. config.setShowSmartDevices(false);
  59. Assert.assertFalse(config.isShowSmartDevices());
  60. config.setShowSmartDevices(true);
  61. Assert.assertTrue(config.isShowSmartDevices());
  62. }
  63. @Test
  64. public void testShowSmartDeviceNamesDefault() {
  65. Assert.assertTrue(config.isShowSmartDeviceNames());
  66. }
  67. @Test
  68. public void testShowSmartDeviceNames() {
  69. config.setShowSmartDeviceNames(false);
  70. Assert.assertFalse(config.isShowSmartDeviceNames());
  71. config.setShowSmartDeviceNames(true);
  72. Assert.assertTrue(config.isShowSmartDeviceNames());
  73. }
  74. @Test
  75. public void testShowTerminatedConnectionsDefault() {
  76. Assert.assertFalse(config.isShowTerminatedConnections());
  77. }
  78. @Test
  79. public void testShowTerminatedConnections() {
  80. config.setShowTerminatedConnections(true);
  81. Assert.assertTrue(config.isShowTerminatedConnections());
  82. config.setShowTerminatedConnections(false);
  83. Assert.assertFalse(config.isShowTerminatedConnections());
  84. }
  85. @Test
  86. public void testGetDeviceVisualizationRadiusDefault() {
  87. Assert.assertEquals(25, config.getDeviceVisualizationRadius());
  88. }
  89. @Test
  90. public void testGetDeviceVisualizationRadius() {
  91. config.setDeviceVisualizationRadius(12);
  92. Assert.assertEquals(12, config.getDeviceVisualizationRadius());
  93. config.setDeviceVisualizationRadius(56);
  94. Assert.assertEquals(56, config.getDeviceVisualizationRadius());
  95. }
  96. }