package io.advantageous.config;

import org.junit.Assert;
import org.junit.Test;

import java.net.URI;
import java.util.Map;

public class JsLoaderTest {

    @Test
    public void testLoadConfig() throws Exception {
        Config config = JsLoader.load("test-config.js");
        URI uri = config.get("myUri", URI.class);
        Assert.assertNotNull(uri);
        Assert.assertEquals("host", uri.getHost());
        Map myMap = config.getMap("someKey");
        Assert.assertNotNull(myMap);
        Assert.assertEquals(234, myMap.get("nestedKey"));
    }
}

@@ -91,67 +91,682 @@
 ava.
-net.URI;%0Aimport java.util.Map;%0A%0Apublic class JsLoaderTest %7B
+lang.reflect.Constructor;%0Aimport java.lang.reflect.InvocationTargetException;%0Aimport java.net.URI;%0Aimport java.util.Map;%0A%0Apublic class JsLoaderTest %7B%0A%0A    @Test(expected = InvocationTargetException.class)%0A    public void testPrivateConstructor() throws Exception %7B%0A        Assert.assertEquals(0, JsLoader.class.getConstructors().length);%0A        Assert.assertEquals(1, JsLoader.class.getDeclaredConstructors().length);%0A        Constructor constructor = JsLoader.class.getDeclaredConstructor();%0A        Assert.assertNotNull(constructor);%0A        Assert.assertFalse(constructor.isAccessible());%0A        constructor.setAccessible(true);%0A        constructor.newInstance();%0A    %7D
 %0A%0A  

enforce utility class is never instantiated