diff options
author | Shadi Haidar <sh1986@att.com> | 2018-09-14 17:22:14 -0400 |
---|---|---|
committer | Shadi Haidar <sh1986@att.com> | 2018-09-14 17:23:12 -0400 |
commit | f8426d18257c33fa8a0267e4f96f7e53bb4a82ee (patch) | |
tree | 78aee264bca03560e43e03ccd2e65dabfef8b44c /src/test/java/org/onap/dcae/inventory/InventoryConfigurationTest.java | |
parent | 4a81073bb3ce0e873bcf38853e66f8ae4150da67 (diff) |
Address warnings
Change-Id: I953b71d130c78bb20cf602e101021e29b538088e
Issue-ID: DCAEGEN2-605
Signed-off-by: Shadi Haidar <sh1986@att.com>
Diffstat (limited to 'src/test/java/org/onap/dcae/inventory/InventoryConfigurationTest.java')
-rw-r--r-- | src/test/java/org/onap/dcae/inventory/InventoryConfigurationTest.java | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/test/java/org/onap/dcae/inventory/InventoryConfigurationTest.java b/src/test/java/org/onap/dcae/inventory/InventoryConfigurationTest.java index f9dadb8..1848a42 100644 --- a/src/test/java/org/onap/dcae/inventory/InventoryConfigurationTest.java +++ b/src/test/java/org/onap/dcae/inventory/InventoryConfigurationTest.java @@ -20,32 +20,36 @@ package org.onap.dcae.inventory; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import java.io.File; + +import javax.validation.Validator; + +import org.junit.Test; + import com.fasterxml.jackson.databind.ObjectMapper; + import io.dropwizard.configuration.YamlConfigurationFactory; import io.dropwizard.jackson.Jackson; import io.dropwizard.jersey.validation.Validators; -import org.junit.Test; - -import javax.validation.Validator; -import java.io.File; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; /** * Created by mhwang on 3/22/18. */ public class InventoryConfigurationTest { - final private ObjectMapper objectMapper = Jackson.newObjectMapper(); - final private Validator validator = Validators.newValidator(); - final private YamlConfigurationFactory<InventoryConfiguration> factory + private final ObjectMapper objectMapper = Jackson.newObjectMapper(); + private final Validator validator = Validators.newValidator(); + private final YamlConfigurationFactory<InventoryConfiguration> factory = new YamlConfigurationFactory<>(InventoryConfiguration.class, validator, objectMapper, "dw"); @Test public void testInventoryConfigurationLoad() { try { - final File yaml = new File(Thread.currentThread().getContextClassLoader().getResource("config-inventory.yaml").getPath()); + final File yaml = new File(Thread.currentThread().getContextClassLoader(). + getResource("config-inventory.yaml").getPath()); InventoryConfiguration configuration = factory.build(yaml); assertEquals(configuration.getDatabusControllerConnection().getHost(), "databus-controller-hostname"); @@ -53,7 +57,7 @@ public class InventoryConfigurationTest { assertEquals(configuration.getDatabusControllerConnection().getRequired(), true); assertEquals(configuration.getDataSourceFactory().getUrl(), "jdbc:postgresql://127.0.0.1:5432/dcae_inv"); - } catch(Exception e) { + } catch (Exception e) { fail("Failed to load config-inventory"); } } |