/*
 * Copyright 2015 Netflix, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.netflix.discovery.providers;

import java.util.List;

import com.google.inject.Injector;
import com.netflix.config.ConfigurationManager;
import com.netflix.discovery.DefaultEurekaClientConfig;
import com.netflix.discovery.EurekaNamespace;
import com.netflix.governator.guice.BootstrapBinder;
import com.netflix.governator.guice.BootstrapModule;
import com.netflix.governator.guice.LifecycleInjector;
import org.junit.Test;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

/**
 * @author Tomasz Bak
 */
public class DefaultEurekaClientConfigProviderTest {

    private static final String SERVICE_URI = "http://my.eureka.server:8080/";

    @Test
    public void testNameSpaceInjection() throws Exception {
        ConfigurationManager.getConfigInstance().setProperty("testnamespace.serviceUrl.default", SERVICE_URI);

        Injector injector = LifecycleInjector.builder()
                .withBootstrapModule(new BootstrapModule() {
                    @Override
                    public void configure(BootstrapBinder binder) {
                        binder.bind(String.class).annotatedWith(EurekaNamespace.class).toInstance("testnamespace.");
                    }
                })
                .build()
                .createInjector();

        DefaultEurekaClientConfig clientConfig = injector.getInstance(DefaultEurekaClientConfig.class);

        List<String> serviceUrls = clientConfig.getEurekaServerServiceUrls("default");
        assertThat(serviceUrls.get(0), is(equalTo(SERVICE_URI)));
    }
}
@@ -736,24 +736,70 @@
 ionManager;%0A
+import com.netflix.discovery.CommonConstants;%0A
 import com.n
@@ -2253,10 +2253,774 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void testURLSeparator() throws Exception %7B%0A        testURLSeparator(%22,%22);%0A        testURLSeparator(%22 ,%22);%0A        testURLSeparator(%22, %22);%0A        testURLSeparator(%22 , %22);%0A        testURLSeparator(%22 ,  %22);%0A    %7D%0A%0A    private void testURLSeparator(String separator) %7B%0A        ConfigurationManager.getConfigInstance().setProperty(CommonConstants.DEFAULT_CONFIG_NAMESPACE + %22.serviceUrl.default%22, SERVICE_URI + separator + SERVICE_URI);%0A%0A        DefaultEurekaClientConfig clientConfig = new DefaultEurekaClientConfig();%0A%0A        List%3CString%3E serviceUrls = clientConfig.getEurekaServerServiceUrls(%22default%22);%0A        assertThat(serviceUrls.get(0), is(equalTo(SERVICE_URI)));%0A        assertThat(serviceUrls.get(1), is(equalTo(SERVICE_URI)));%0A    %7D
 %0A%7D

add test case