From b123c50f2e87bb6ba0b2dae9882e7f9a0efcdaa5 Mon Sep 17 00:00:00 2001 From: Obique PSWG Date: Sun, 19 Jul 2015 12:35:35 -0500 Subject: [PATCH] Added all tests to the main test suite and added the new test: TestConfig --- test/main/TestAll.java | 8 ++---- test/resources/TestResources.java | 23 +++++++++++++++ test/resources/services/TestConfig.java | 37 +++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 test/resources/TestResources.java create mode 100644 test/resources/services/TestConfig.java diff --git a/test/main/TestAll.java b/test/main/TestAll.java index c3166543e..4c804f00a 100644 --- a/test/main/TestAll.java +++ b/test/main/TestAll.java @@ -7,17 +7,13 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import resources.TestSortedLinkedList; -import resources.objects.quadtree.TestQuadTree; -import resources.server_info.TestObjectDatabase; +import resources.TestResources; @RunWith(Suite.class) @SuiteClasses({ TestEncryption.class, TestFragmented.class, - TestQuadTree.class, - TestObjectDatabase.class, - TestSortedLinkedList.class + TestResources.class }) public class TestAll { diff --git a/test/resources/TestResources.java b/test/resources/TestResources.java new file mode 100644 index 000000000..c7c28b7ee --- /dev/null +++ b/test/resources/TestResources.java @@ -0,0 +1,23 @@ +package resources; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import resources.collections.SWGListTest; +import resources.objects.quadtree.TestQuadTree; +import resources.server_info.TestObjectDatabase; +import resources.services.TestConfig; + +@RunWith(Suite.class) +@SuiteClasses({ + SWGListTest.class, + TestSortedLinkedList.class, + TestWeatherType.class, + TestQuadTree.class, + TestObjectDatabase.class, + TestConfig.class +}) +public class TestResources { + +} diff --git a/test/resources/services/TestConfig.java b/test/resources/services/TestConfig.java new file mode 100644 index 000000000..24ee77962 --- /dev/null +++ b/test/resources/services/TestConfig.java @@ -0,0 +1,37 @@ +package resources.services; + +import java.io.File; +import java.io.IOException; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +import resources.server_info.Config; + +@RunWith(JUnit4.class) +public class TestConfig { + + private static final File file = new File("test_config.cfg"); + + static { + try { + file.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + file.deleteOnExit(); + } + + @Test + public void testGetSet() { + Config c = new Config(file); + c.setProperty("TEST-VALUE", true); + c.save(); + c.load(); + Assert.assertTrue(c.getBoolean("TEST-VALUE", false)); + file.delete(); + } + +}