Commit 1e40bff1 authored by Phillip Webb's avatar Phillip Webb

Polish

parent 7d80f0ef
/* /*
* Copyright 2012-2014 the original author or authors. * Copyright 2012-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2014 the original author or authors. * Copyright 2012-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2014 the original author or authors. * Copyright 2012-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2014 the original author or authors. * Copyright 2012-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd"> http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>${foo}/repository</localRepository> <localRepository>${foo}/repository</localRepository>
</settings> </settings>
\ No newline at end of file
...@@ -92,12 +92,11 @@ public abstract class EnvironmentTestUtils { ...@@ -92,12 +92,11 @@ public abstract class EnvironmentTestUtils {
int equalIndex = pair.indexOf("="); int equalIndex = pair.indexOf("=");
if (colonIndex == -1) { if (colonIndex == -1) {
return equalIndex; return equalIndex;
} else if (equalIndex == -1) {
return colonIndex;
} }
else { if (equalIndex == -1) {
return Math.min(colonIndex, equalIndex); return colonIndex;
} }
return Math.min(colonIndex, equalIndex);
} }
} }
...@@ -20,7 +20,6 @@ import java.util.HashMap; ...@@ -20,7 +20,6 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.junit.Test; import org.junit.Test;
import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MapPropertySource; import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.StandardEnvironment; import org.springframework.core.env.StandardEnvironment;
...@@ -71,16 +70,18 @@ public class EnvironmentTestUtilsTests { ...@@ -71,16 +70,18 @@ public class EnvironmentTestUtilsTests {
@Test @Test
public void addPairNoValue() { public void addPairNoValue() {
String propertyName = "my.foo+bar"; String propertyName = "my.foo+bar";
assertFalse(environment.containsProperty(propertyName)); assertFalse(this.environment.containsProperty(propertyName));
EnvironmentTestUtils.addEnvironment(environment, propertyName); EnvironmentTestUtils.addEnvironment(this.environment, propertyName);
assertTrue(environment.containsProperty(propertyName)); assertTrue(this.environment.containsProperty(propertyName));
assertEquals("", environment.getProperty(propertyName)); assertEquals("", this.environment.getProperty(propertyName));
} }
private void testAddSimplePair(String key, String value, String delimiter) { private void testAddSimplePair(String key, String value, String delimiter) {
assertFalse("Property '" + key + "' should not exist", environment.containsProperty(key)); assertFalse("Property '" + key + "' should not exist",
EnvironmentTestUtils.addEnvironment(environment, key + delimiter + value); this.environment.containsProperty(key));
assertEquals("Wrong value for property '" + key + "'", value, environment.getProperty(key)); EnvironmentTestUtils.addEnvironment(this.environment, key + delimiter + value);
assertEquals("Wrong value for property '" + key + "'", value,
this.environment.getProperty(key));
} }
@Test @Test
...@@ -88,10 +89,10 @@ public class EnvironmentTestUtilsTests { ...@@ -88,10 +89,10 @@ public class EnvironmentTestUtilsTests {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put("my.foo", "bar"); map.put("my.foo", "bar");
MapPropertySource source = new MapPropertySource("sample", map); MapPropertySource source = new MapPropertySource("sample", map);
environment.getPropertySources().addFirst(source); this.environment.getPropertySources().addFirst(source);
assertEquals("bar", environment.getProperty("my.foo")); assertEquals("bar", this.environment.getProperty("my.foo"));
EnvironmentTestUtils.addEnvironment(environment, "my.foo=bar2"); EnvironmentTestUtils.addEnvironment(this.environment, "my.foo=bar2");
assertEquals("bar2", environment.getProperty("my.foo")); assertEquals("bar2", this.environment.getProperty("my.foo"));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment