/*
 * Copyright 2012-2013 the original author or authors.
 *
 * 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 org.springframework.boot.test;

import java.util.HashMap;
import java.util.Map;

import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MapPropertySource;

/**
 * Test utilities for setting environment values.
 * 
 * @author Dave Syer
 */
public abstract class EnvironmentTestUtils {

	public static void addEnvironment(ConfigurableApplicationContext context,
			String... pairs) {
		addEnvironment(context.getEnvironment(), pairs);
	}

	public static void addEnvironment(ConfigurableEnvironment environment, String... pairs) {
		Map<String, Object> map = new HashMap<String, Object>();
		for (String pair : pairs) {
			int index = pair.indexOf(":");
			String key = pair.substring(0, index > 0 ? index : pair.length());
			String value = index > 0 ? pair.substring(index + 1) : "";
			map.put(key.trim(), value.trim());
		}
		environment.getPropertySources().addFirst(new MapPropertySource("test", map));
	}

}

@@ -704,16 +704,71 @@
 l.Map;%0A%0A
+import org.springframework.context.ApplicationContext;%0A
 import o
@@ -887,16 +887,65 @@
 onment;%0A
+import org.springframework.core.env.Environment;%0A
 import o
@@ -1126,158 +1126,721 @@
 %7B%0A%0A%09
-public static void addEnvironment(ConfigurableApplicationContext context,%0A%09%09%09String... pairs) %7B%0A%09%09addEnvironment(context.getEnvironment(), pairs);%0A%09%7D%0A
+/**%0A%09 * Add additional (high priority) values to an %7B@link Environment%7D owned by an%0A%09 * %7B@link ApplicationContext%7D. Name-value pairs can be specified with colon (%22:%22) or%0A%09 * equals (%22=%22) separators.%0A%09 * %0A%09 * @param context the context with an environment to modify%0A%09 * @param pairs the name:value pairs%0A%09 */%0A%09public static void addEnvironment(ConfigurableApplicationContext context,%0A%09%09%09String... pairs) %7B%0A%09%09addEnvironment(context.getEnvironment(), pairs);%0A%09%7D%0A%0A%09/**%0A%09 * Add additional (high priority) values to an %7B@link Environment%7D. Name-value pairs%0A%09 * can be specified with colon (%22:%22) or equals (%22=%22) separators.%0A%09 * %0A%09 * @param environment the environment to modify%0A%09 * @param pairs the name:value pairs%0A%09 */
 %0A%09pu
@@ -1907,17 +1907,20 @@
 ronment,
- 
+%0A%09%09%09
 String..
@@ -2053,16 +2053,74 @@
 f(%22:%22);%0A
+%09%09%09index = index %3C 0 ? index = pair.indexOf(%22=%22) : index;%0A
 %09%09%09Strin

Add support for = separator in EnvironmentTestUtils