package org.sagebionetworks.bridge.config;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class BridgeConfigTest {

    @Before
    public void before() {
        System.setProperty("bridge.pwd", "when.the.password.is.not.a.password");
        System.setProperty("bridge.salt", "when.the.salt.is.some.random.sea.salt");
        System.setProperty("bridge.user", "unit.test");
    }

    @After
    public void after() {
        System.clearProperty("bridge.pwd");
        System.clearProperty("bridge.salt");
        System.clearProperty("bridge.user");
        System.clearProperty("bridge.env");
    }

    @Test
    public void testDefault() {
        BridgeConfig config = new BridgeConfig();
        assertTrue(config.isStub());
        assertNull(config.getProperty("someFakePropertyThatDoesNotExist"));
    }

    @Test
    public void testEncryption() {
        BridgeConfig config = new BridgeConfig();
        assertEquals("example.value", config.getProperty("example.property"));
        assertEquals("example.value.encrypted", config.getProperty("example.property.encrypted"));
    }

    @Test
    public void testEnvironment() {
        System.setProperty("bridge.env", "dev");
        BridgeConfig config = new BridgeConfig();
        assertEquals("example.value.for.dev", config.getProperty("example.property"));
    }

    @Test
    public void testUser() {
        BridgeConfig config = new BridgeConfig();
        assertEquals("unit.test", config.getUser());
    }
}

@@ -169,16 +169,46 @@
 tTrue;%0A%0A
+import java.util.Properties;%0A%0A
 import o
@@ -270,16 +270,74 @@
 it.Test;
+%0Aimport org.springframework.test.util.ReflectionTestUtils;
 %0A%0Apublic
@@ -936,32 +936,159 @@
 BridgeConfig();%0A
+        Properties props = (Properties)ReflectionTestUtils.getField(config, %22properties%22);%0A        props.remove(%22bridge.env%22);%0A
         assertTr

Fix failed unit test in Travis CI.