From 63b0ba08d760402d23ec74750ecc2638e1eddcf0 Mon Sep 17 00:00:00 2001 From: Enzo Zafra Date: Thu, 17 Oct 2019 17:43:15 -0600 Subject: [PATCH] add tests --- .../cloudraider/utils/ConfigUtilsTest.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 cloudraider-core/src/test/java/com/intuit/cloudraider/utils/ConfigUtilsTest.java diff --git a/cloudraider-core/src/test/java/com/intuit/cloudraider/utils/ConfigUtilsTest.java b/cloudraider-core/src/test/java/com/intuit/cloudraider/utils/ConfigUtilsTest.java new file mode 100644 index 0000000..8254d9e --- /dev/null +++ b/cloudraider-core/src/test/java/com/intuit/cloudraider/utils/ConfigUtilsTest.java @@ -0,0 +1,50 @@ +/* + * Apache 2.0 License + * + * Copyright (c) 2019 Intuit Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package com.intuit.cloudraider.utils; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; + +public class ConfigUtilsTest { + + /** + * Test getConfigFilePath utility. + * + */ + @Test + public void testGetConfigFilePath() { + String mockedPath = "customConfigFilePath.properties"; + System.setProperty("configFilePath", mockedPath); + assertEquals(mockedPath, ConfigUtils.getConfigFilePath()); + } + + @Test + public void testGetConfigFilePath_default() { + String defaultPath = "config.properties"; + assertEquals(defaultPath, ConfigUtils.getConfigFilePath()); + } +}