Ensure UPPER_CASE overrides work in PropertiesLauncher

This commit is contained in:
Dave Syer
2013-10-14 11:16:40 -04:00
parent 17e24fd17d
commit 114b7a5e95
5 changed files with 60 additions and 17 deletions

View File

@@ -72,6 +72,15 @@ public class PropertiesLauncherTests {
assertEquals("[etc/]", ReflectionTestUtils.getField(launcher, "paths").toString());
}
@Test
public void testUserSpecifiedConfigPathWins() throws Exception {
System.setProperty("loader.config.name", "foo");
System.setProperty("loader.config.location", "classpath:bar.properties");
PropertiesLauncher launcher = new PropertiesLauncher();
assertEquals("my.BarApplication", launcher.getMainClass());
}
@Test
public void testSystemPropertySpecifiedMain() throws Exception {
System.setProperty("loader.main", "foo.Bar");

View File

@@ -19,7 +19,6 @@ package org.springframework.boot.loader.util;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.loader.util.SystemPropertyUtils;
import static org.junit.Assert.assertEquals;
@@ -53,4 +52,9 @@ public class SystemPropertyUtilsTests {
assertEquals("foo", SystemPropertyUtils.resolvePlaceholders("${bar:${spam:foo}}"));
}
@Test
public void testEnvVar() {
assertEquals(System.getenv("LANG"), SystemPropertyUtils.getProperty("lang"));
}
}

View File

@@ -0,0 +1 @@
loader.main: my.BarApplication