diff --git a/spring-boot-cli/pom.xml b/spring-boot-cli/pom.xml
index 9240777b4cc..aa5900a5df2 100644
--- a/spring-boot-cli/pom.xml
+++ b/spring-boot-cli/pom.xml
@@ -130,23 +130,6 @@
provided
-
- ${project.groupId}
- spring-boot
- ${project.version}
- tests
- test
-
-
- ${project.groupId}
- spring-boot
-
-
- commons-logging
- commons-logging
-
-
-
org.javassist
javassist
diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java
index 52bb45bebfb..6fceb1e8f06 100644
--- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java
+++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java
@@ -32,12 +32,12 @@ import org.junit.Assume;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
-import org.springframework.boot.OutputCapture;
import org.springframework.boot.cli.command.AbstractCommand;
import org.springframework.boot.cli.command.OptionParsingCommand;
import org.springframework.boot.cli.command.grab.GrabCommand;
import org.springframework.boot.cli.command.run.RunCommand;
import org.springframework.boot.cli.command.test.TestCommand;
+import org.springframework.boot.cli.util.OutputCapture;
/**
* {@link TestRule} that can be used to invoke CLI commands.
diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/util/OutputCapture.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/util/OutputCapture.java
new file mode 100644
index 00000000000..89ccee1c8cc
--- /dev/null
+++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/util/OutputCapture.java
@@ -0,0 +1,127 @@
+/*
+ * 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.cli.util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+/**
+ * Capture output from System.out and System.err.
+ *
+ * @author Phillip Webb
+ */
+public class OutputCapture implements TestRule {
+
+ private CaptureOutputStream captureOut;
+
+ private CaptureOutputStream captureErr;
+
+ private ByteArrayOutputStream copy;
+
+ @Override
+ public Statement apply(final Statement base, Description description) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ captureOutput();
+ try {
+ base.evaluate();
+ }
+ finally {
+ releaseOutput();
+ }
+ }
+ };
+ }
+
+ protected void captureOutput() {
+ this.copy = new ByteArrayOutputStream();
+ this.captureOut = new CaptureOutputStream(System.out, this.copy);
+ this.captureErr = new CaptureOutputStream(System.err, this.copy);
+ System.setOut(new PrintStream(this.captureOut));
+ System.setErr(new PrintStream(this.captureErr));
+ }
+
+ protected void releaseOutput() {
+ System.setOut(this.captureOut.getOriginal());
+ System.setErr(this.captureErr.getOriginal());
+ this.copy = null;
+ }
+
+ public void flush() {
+ try {
+ this.captureOut.flush();
+ this.captureErr.flush();
+ }
+ catch (IOException ex) {
+ // ignore
+ }
+ }
+
+ @Override
+ public String toString() {
+ flush();
+ return this.copy.toString();
+ }
+
+ private static class CaptureOutputStream extends OutputStream {
+
+ private final PrintStream original;
+
+ private final OutputStream copy;
+
+ public CaptureOutputStream(PrintStream original, OutputStream copy) {
+ this.original = original;
+ this.copy = copy;
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ this.copy.write(b);
+ this.original.write(b);
+ this.original.flush();
+ }
+
+ @Override
+ public void write(byte[] b) throws IOException {
+ write(b, 0, b.length);
+ }
+
+ @Override
+ public void write(byte[] b, int off, int len) throws IOException {
+ this.copy.write(b, off, len);
+ this.original.write(b, off, len);
+ }
+
+ public PrintStream getOriginal() {
+ return this.original;
+ }
+
+ @Override
+ public void flush() throws IOException {
+ this.copy.flush();
+ this.original.flush();
+ }
+ }
+
+}
diff --git a/spring-boot-samples/spring-boot-sample-aop/src/test/java/sample/aop/SampleAopApplicationTests.java b/spring-boot-samples/spring-boot-sample-aop/src/test/java/sample/aop/SampleAopApplicationTests.java
index 4204125c7f8..cb682f698c8 100644
--- a/spring-boot-samples/spring-boot-sample-aop/src/test/java/sample/aop/SampleAopApplicationTests.java
+++ b/spring-boot-samples/spring-boot-sample-aop/src/test/java/sample/aop/SampleAopApplicationTests.java
@@ -20,9 +20,9 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.springframework.boot.OutputCapture;
-import sample.aop.SampleAopApplication;
+import org.springframework.boot.test.OutputCapture;
+import sample.aop.SampleAopApplication;
import static org.junit.Assert.assertTrue;
/**
diff --git a/spring-boot-samples/spring-boot-sample-batch/src/test/java/sample/batch/SampleBatchApplicationTests.java b/spring-boot-samples/spring-boot-sample-batch/src/test/java/sample/batch/SampleBatchApplicationTests.java
index 5d87949eabc..7c6cfe6ebc7 100644
--- a/spring-boot-samples/spring-boot-sample-batch/src/test/java/sample/batch/SampleBatchApplicationTests.java
+++ b/spring-boot-samples/spring-boot-sample-batch/src/test/java/sample/batch/SampleBatchApplicationTests.java
@@ -18,8 +18,8 @@ package sample.batch;
import org.junit.Rule;
import org.junit.Test;
-import org.springframework.boot.OutputCapture;
import org.springframework.boot.SpringApplication;
+import org.springframework.boot.test.OutputCapture;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
diff --git a/spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java
index 990a6d046ae..faa80cb8569 100644
--- a/spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java
+++ b/spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java
@@ -22,7 +22,7 @@ import java.io.IOException;
import org.junit.Rule;
import org.junit.Test;
-import org.springframework.boot.OutputCapture;
+import org.springframework.boot.test.OutputCapture;
import org.springframework.core.NestedCheckedException;
/**
diff --git a/spring-boot-samples/spring-boot-sample-data-redis/src/test/java/sample/data/redis/SampleRedisApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-redis/src/test/java/sample/data/redis/SampleRedisApplicationTests.java
index 9936f4ad036..7d5fac33659 100644
--- a/spring-boot-samples/spring-boot-sample-data-redis/src/test/java/sample/data/redis/SampleRedisApplicationTests.java
+++ b/spring-boot-samples/spring-boot-sample-data-redis/src/test/java/sample/data/redis/SampleRedisApplicationTests.java
@@ -18,7 +18,7 @@ package sample.data.redis;
import org.junit.Rule;
import org.junit.Test;
-import org.springframework.boot.OutputCapture;
+import org.springframework.boot.test.OutputCapture;
import org.springframework.data.redis.RedisConnectionFailureException;
import static org.junit.Assert.assertTrue;
diff --git a/spring-boot-samples/spring-boot-sample-profile/src/test/java/sample/profile/SampleProfileApplicationTests.java b/spring-boot-samples/spring-boot-sample-profile/src/test/java/sample/profile/SampleProfileApplicationTests.java
index 09657c72dda..876cd36e112 100644
--- a/spring-boot-samples/spring-boot-sample-profile/src/test/java/sample/profile/SampleProfileApplicationTests.java
+++ b/spring-boot-samples/spring-boot-sample-profile/src/test/java/sample/profile/SampleProfileApplicationTests.java
@@ -20,7 +20,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.springframework.boot.OutputCapture;
+import org.springframework.boot.test.OutputCapture;
import static org.junit.Assert.assertTrue;
diff --git a/spring-boot-samples/spring-boot-sample-simple/src/test/java/sample/simple/SampleSimpleApplicationTests.java b/spring-boot-samples/spring-boot-sample-simple/src/test/java/sample/simple/SampleSimpleApplicationTests.java
index 93226709ec5..b1f52e7b8bf 100644
--- a/spring-boot-samples/spring-boot-sample-simple/src/test/java/sample/simple/SampleSimpleApplicationTests.java
+++ b/spring-boot-samples/spring-boot-sample-simple/src/test/java/sample/simple/SampleSimpleApplicationTests.java
@@ -20,7 +20,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.springframework.boot.OutputCapture;
+import org.springframework.boot.test.OutputCapture;
import static org.junit.Assert.assertTrue;
diff --git a/spring-boot-samples/spring-boot-sample-xml/src/test/java/sample/xml/SampleSpringXmlApplicationTests.java b/spring-boot-samples/spring-boot-sample-xml/src/test/java/sample/xml/SampleSpringXmlApplicationTests.java
index aa695077182..99e50d47080 100644
--- a/spring-boot-samples/spring-boot-sample-xml/src/test/java/sample/xml/SampleSpringXmlApplicationTests.java
+++ b/spring-boot-samples/spring-boot-sample-xml/src/test/java/sample/xml/SampleSpringXmlApplicationTests.java
@@ -18,7 +18,7 @@ package sample.xml;
import org.junit.Rule;
import org.junit.Test;
-import org.springframework.boot.OutputCapture;
+import org.springframework.boot.test.OutputCapture;
import static org.junit.Assert.assertTrue;
diff --git a/spring-boot-starters/spring-boot-starter-parent/pom.xml b/spring-boot-starters/spring-boot-starter-parent/pom.xml
index c4ef6555144..250e69bb701 100644
--- a/spring-boot-starters/spring-boot-starter-parent/pom.xml
+++ b/spring-boot-starters/spring-boot-starter-parent/pom.xml
@@ -32,12 +32,6 @@
spring-boot
0.5.0.BUILD-SNAPSHOT
-
- org.springframework.boot
- spring-boot
- 0.5.0.BUILD-SNAPSHOT
- tests
-
org.springframework.boot
spring-boot-starter
diff --git a/spring-boot-starters/spring-boot-starter-test/pom.xml b/spring-boot-starters/spring-boot-starter-test/pom.xml
index 14354d0ddfb..a473f690a6f 100644
--- a/spring-boot-starters/spring-boot-starter-test/pom.xml
+++ b/spring-boot-starters/spring-boot-starter-test/pom.xml
@@ -18,12 +18,6 @@
spring-boot-starter-logging
${project.version}
-
- ${project.groupId}
- spring-boot
- tests
- ${project.version}
-
junit
junit
diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml
index d22e7ca4d48..c2397a587bb 100644
--- a/spring-boot/pom.xml
+++ b/spring-boot/pom.xml
@@ -39,6 +39,11 @@
javax.servlet-api
true
+
+ junit
+ junit
+ true
+
log4j
log4j
@@ -89,6 +94,11 @@
jul-to-slf4j
true
+
+ org.springframework
+ spring-test
+ true
+
org.springframework
spring-web
@@ -115,11 +125,6 @@
tomcat-embed-logging-juli
test
-
- org.springframework
- spring-test
- test
-
org.springframework
spring-webmvc
diff --git a/spring-boot/src/test/java/org/springframework/boot/test/EnvironmentTestUtils.java b/spring-boot/src/main/java/org/springframework/boot/test/EnvironmentTestUtils.java
similarity index 100%
rename from spring-boot/src/test/java/org/springframework/boot/test/EnvironmentTestUtils.java
rename to spring-boot/src/main/java/org/springframework/boot/test/EnvironmentTestUtils.java
diff --git a/spring-boot/src/test/java/org/springframework/boot/OutputCapture.java b/spring-boot/src/main/java/org/springframework/boot/test/OutputCapture.java
similarity index 98%
rename from spring-boot/src/test/java/org/springframework/boot/OutputCapture.java
rename to spring-boot/src/main/java/org/springframework/boot/test/OutputCapture.java
index 3da40f34710..544ab655578 100644
--- a/spring-boot/src/test/java/org/springframework/boot/OutputCapture.java
+++ b/spring-boot/src/main/java/org/springframework/boot/test/OutputCapture.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.boot;
+package org.springframework.boot.test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
diff --git a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationConfiguration.java b/spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationConfiguration.java
similarity index 100%
rename from spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationConfiguration.java
rename to spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationConfiguration.java
diff --git a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationContextLoader.java b/spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java
similarity index 100%
rename from spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationContextLoader.java
rename to spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java
diff --git a/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java b/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java
index a976764dabb..7d598204b30 100644
--- a/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java
+++ b/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java
@@ -22,6 +22,7 @@ import java.util.List;
import org.junit.Rule;
import org.junit.Test;
+import org.springframework.boot.test.OutputCapture;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
diff --git a/spring-boot/src/test/java/org/springframework/boot/context/listener/LoggingApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/listener/LoggingApplicationListenerTests.java
index 6aeebbc5cb6..9c5c7a42e77 100644
--- a/spring-boot/src/test/java/org/springframework/boot/context/listener/LoggingApplicationListenerTests.java
+++ b/spring-boot/src/test/java/org/springframework/boot/context/listener/LoggingApplicationListenerTests.java
@@ -27,12 +27,12 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
-import org.springframework.boot.OutputCapture;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringApplicationStartEvent;
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.logging.java.JavaLoggingSystem;
import org.springframework.boot.test.EnvironmentTestUtils;
+import org.springframework.boot.test.OutputCapture;
import org.springframework.context.support.GenericApplicationContext;
import static org.hamcrest.Matchers.containsString;
diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggerSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggerSystemTests.java
index 4c5e66432f5..f05ba51a005 100644
--- a/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggerSystemTests.java
+++ b/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggerSystemTests.java
@@ -23,8 +23,8 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.springframework.boot.OutputCapture;
import org.springframework.boot.logging.LogLevel;
+import org.springframework.boot.test.OutputCapture;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/log4j/Log4JLoggingSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/log4j/Log4JLoggingSystemTests.java
index b6208c76af5..cf76069628f 100644
--- a/spring-boot/src/test/java/org/springframework/boot/logging/log4j/Log4JLoggingSystemTests.java
+++ b/spring-boot/src/test/java/org/springframework/boot/logging/log4j/Log4JLoggingSystemTests.java
@@ -21,8 +21,8 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.springframework.boot.OutputCapture;
import org.springframework.boot.logging.LogLevel;
+import org.springframework.boot.test.OutputCapture;
import org.springframework.util.StringUtils;
import static org.hamcrest.Matchers.equalTo;
diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java
index 27e123bb37d..0816509b266 100644
--- a/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java
+++ b/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java
@@ -22,8 +22,8 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.springframework.boot.OutputCapture;
import org.springframework.boot.logging.LogLevel;
+import org.springframework.boot.test.OutputCapture;
import org.springframework.util.StringUtils;
import static org.hamcrest.Matchers.equalTo;