Repository: zalando/logbook (java)

Issue:
Extract testing utilities into own module
- MockRawHttpRequest
- MockHttpRequest
- ...

Pull request description:
Extracted API and Test modules
This fixes #55

Patch:
diff --git a/logbook-api/pom.xml b/logbook-api/pom.xml
new file mode 100644
index 00000000..02308504
--- /dev/null
+++ b/logbook-api/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <prerequisites>
+        <maven>3.0.4</maven>
+    </prerequisites>
+
+    <parent>
+        <groupId>org.zalando</groupId>
+        <artifactId>logbook-parent</artifactId>
+        <version>0.15.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>logbook-api</artifactId>
+
+    <name>Logbook: API</name>
+    <description>HTTP request and response logging</description>
+
+    <scm>
+        <url>https://github.com/zalando/logbook</url>
+        <connection>scm:git:git@github.com:zalando//logbook.git</connection>
+        <developerConnection>scm:git:git@github.com:zalando//logbook.git</developerConnection>
+    </scm>
+
+    <dependencies>
+    </dependencies>
+
+    <distributionManagement>
+        <snapshotRepository>
+            <id>ossrh</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+        </snapshotRepository>
+        <repository>
+            <id>ossrh</id>
+            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
+        </repository>
+    </distributionManagement>
+
+</project>
diff --git a/logbook-core/src/main/java/org/zalando/logbook/BaseHttpMessage.java b/logbook-api/src/main/java/org/zalando/logbook/BaseHttpMessage.java
similarity index 98%
rename from logbook-core/src/main/java/org/zalando/logbook/BaseHttpMessage.java
rename to logbook-api/src/main/java/org/zalando/logbook/BaseHttpMessage.java
index fca0096a..643d1440 100644
--- a/logbook-core/src/main/java/org/zalando/logbook/BaseHttpMessage.java
+++ b/logbook-api/src/main/java/org/zalando/logbook/BaseHttpMessage.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: API
  * %%
  * Copyright (C) 2015 - 2016 Zalando SE
  * %%
diff --git a/logbook-core/src/main/java/org/zalando/logbook/BaseHttpRequest.java b/logbook-api/src/main/java/org/zalando/logbook/BaseHttpRequest.java
similarity index 98%
rename from logbook-core/src/main/java/org/zalando/logbook/BaseHttpRequest.java
rename to logbook-api/src/main/java/org/zalando/logbook/BaseHttpRequest.java
index 566198e5..b96aec12 100644
--- a/logbook-core/src/main/java/org/zalando/logbook/BaseHttpRequest.java
+++ b/logbook-api/src/main/java/org/zalando/logbook/BaseHttpRequest.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: API
  * %%
  * Copyright (C) 2015 Zalando SE
  * %%
diff --git a/logbook-core/src/main/java/org/zalando/logbook/BaseHttpResponse.java b/logbook-api/src/main/java/org/zalando/logbook/BaseHttpResponse.java
similarity index 97%
rename from logbook-core/src/main/java/org/zalando/logbook/BaseHttpResponse.java
rename to logbook-api/src/main/java/org/zalando/logbook/BaseHttpResponse.java
index 9abac917..7b98572b 100644
--- a/logbook-core/src/main/java/org/zalando/logbook/BaseHttpResponse.java
+++ b/logbook-api/src/main/java/org/zalando/logbook/BaseHttpResponse.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: API
  * %%
  * Copyright (C) 2015 Zalando SE
  * %%
diff --git a/logbook-core/src/main/java/org/zalando/logbook/BodyObfuscator.java b/logbook-api/src/main/java/org/zalando/logbook/BodyObfuscator.java
similarity index 98%
rename from logbook-core/src/main/java/org/zalando/logbook/BodyObfuscator.java
rename to logbook-api/src/main/java/org/zalando/logbook/BodyObfuscator.java
index 00e7b72e..968b58af 100644
--- a/logbook-core/src/main/java/org/zalando/logbook/BodyObfuscator.java
+++ b/logbook-api/src/main/java/org/zalando/logbook/BodyObfuscator.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: API
  * %%
  * Copyright (C) 2015 Zalando SE
  * %%
diff --git a/logbook-core/src/main/java/org/zalando/logbook/Correlation.java b/logbook-api/src/main/java/org/zalando/logbook/Correlation.java
similarity index 97%
rename from logbook-core/src/main/java/org/zalando/logbook/Correlation.java
rename to logbook-api/src/main/java/org/zalando/logbook/Correlation.java
index cc4b29e6..a7d8e8f0 100644
--- a/logbook-core/src/main/java/org/zalando/logbook/Correlation.java
+++ b/logbook-api/src/main/java/org/zalando/logbook/Correlation.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: API
  * %%
  * Copyright (C) 2015 Zalando SE
  * %%
diff --git a/logbook-core/src/main/java/org/zalando/logbook/Correlator.java b/logbook-api/src/main/java/org/zalando/logbook/Correlator.java
similarity index 97%
rename from logbook-core/src/main/java/org/zalando/logbook/Correlator.java
rename to logbook-api/src/main/java/org/zalando/logbook/Correlator.java
index 30cf4fad..62d2e42a 100644
--- a/logbook-core/src/main/java/org/zalando/logbook/Correlator.java
+++ b/logbook-api/src/main/java/org/zalando/logbook/Correlator.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: API
  * %%
  * Copyright (C) 2015 Zalando SE
  * %%
diff --git a/logbook-core/src/main/java/org/zalando/logbook/HttpLogFormatter.java b/logbook-api/src/main/java/org/zalando/logbook/HttpLogFormatter.java
similarity index 100%
rename from logbook-core/src/main/java/org/zalando/logbook/HttpLogFormatter.java
rename to logbook-api/src/main/java/org/zalando/logbook/HttpLogFormatter.java
diff --git a/logbook-core/src/main/java/org/zalando/logbook/HttpLogWriter.java b/logbook-api/src/main/java/org/zalando/logbook/HttpLogWriter.java
similarity index 100%
rename from logbook-core/src/main/java/org/zalando/logbook/HttpLogWriter.java
rename to logbook-api/src/main/java/org/zalando/logbook/HttpLogWriter.java
diff --git a/logbook-core/src/main/java/org/zalando/logbook/HttpMessage.java b/logbook-api/src/main/java/org/zalando/logbook/HttpMessage.java
similarity index 98%
rename from logbook-core/src/main/java/org/zalando/logbook/HttpMessage.java
rename to logbook-api/src/main/java/org/zalando/logbook/HttpMessage.java
index 5c38c91d..e9895a4d 100644
--- a/logbook-core/src/main/java/org/zalando/logbook/HttpMessage.java
+++ b/logbook-api/src/main/java/org/zalando/logbook/HttpMessage.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: API
  * %%
  * Copyright (C) 2015 Zalando SE
  * %%
diff --git a/logbook-core/src/main/java/org/zalando/logbook/HttpRequest.java b/logbook-api/src/main/java/org/zalando/logbook/HttpRequest.java
similarity index 97%
rename from logbook-core/src/main/java/org/zalando/logbook/HttpRequest.java
rename to logbook-api/src/main/java/org/zalando/logbook/HttpRequest.java
index 11c77817..cdd05bca 100644
--- a/logbook-core/src/main/java/org/zalando/logbook/HttpRequest.java
+++ b/logbook-api/src/main/java/org/zalando/logbook/HttpRequest.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: API
  * %%
  * Copyright (C) 2015 Zalando SE
  * %%
diff --git a/logbook-core/src/main/java/org/zalando/logbook/HttpResponse.java b/logbook-api/src/main/java/org/zalando/logbook/HttpResponse.java
similarity index 97%
rename from logbook-core/src/main/java/org/zalando/logbook/HttpResponse.java
rename to logbook-api/src/main/java/org/zalando/logbook/HttpResponse.java
index 84cfe92b..e88edd61 100644
--- a/logbook-core/src/main/java/org/zalando/logbook/HttpResponse.java
+++ b/logbook-api/src/main/java/org/zalando/logbook/HttpResponse.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: API
  * %%
  * Copyright (C) 2015 Zalando SE
  * %%
diff --git a/logbook-core/src/main/java/org/zalando/logbook/Logbook.java b/logbook-api/src/main/java/org/zalando/logbook/Logbook.java
similarity index 70%
rename from logbook-core/src/main/java/org/zalando/logbook/Logbook.java
rename to logbook-api/src/main/java/org/zalando/logbook/Logbook.java
index 133c8fc3..089d4324 100644
--- a/logbook-core/src/main/java/org/zalando/logbook/Logbook.java
+++ b/logbook-api/src/main/java/org/zalando/logbook/Logbook.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: API
  * %%
  * Copyright (C) 2015 Zalando SE
  * %%
@@ -25,8 +25,6 @@ import java.io.IOException;
 import java.util.Optional;
 import java.util.function.Predicate;
 
-import static com.google.common.base.MoreObjects.firstNonNull;
-
 public interface Logbook {
 
     Optional<Correlator> write(final RawHttpRequest request) throws IOException;
@@ -43,14 +41,8 @@ public interface Logbook {
             @Nullable final Obfuscator parameterObfuscator,
             @Nullable final BodyObfuscator bodyObfuscator) {
 
-        return new DefaultLogbook(
-                firstNonNull(formatter, new DefaultHttpLogFormatter()),
-                firstNonNull(writer, new DefaultHttpLogWriter()),
-                firstNonNull(predicate, request -> true),
-                new Obfuscation(
-                        firstNonNull(headerObfuscator, Obfuscator.authorization()),
-                        firstNonNull(parameterObfuscator, Obfuscator.none()),
-                        firstNonNull(bodyObfuscator, BodyObfuscator.none())));
+        final LogbookFactory factory = LogbookFactory.INSTANCE;
+        return factory.create(formatter, writer, predicate, headerObfuscator, parameterObfuscator, bodyObfuscator);
     }
 
 }
diff --git a/logbook-api/src/main/java/org/zalando/logbook/LogbookFactory.java b/logbook-api/src/main/java/org/zalando/logbook/LogbookFactory.java
new file mode 100644
index 00000000..1f59cc0a
--- /dev/null
+++ b/logbook-api/src/main/java/org/zalando/logbook/LogbookFactory.java
@@ -0,0 +1,40 @@
+package org.zalando.logbook;
+
+/*
+ * #%L
+ * Logbook: API
+ * %%
+ * Copyright (C) 2015 - 2016 Zalando SE
+ * %%
+ * 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.
+ * #L%
+ */
+
+import javax.annotation.Nullable;
+import java.util.function.Predicate;
+
+import static com.google.common.collect.Iterables.getOnlyElement;
+import static java.util.ServiceLoader.load;
+
+interface LogbookFactory {
+
+    LogbookFactory INSTANCE = getOnlyElement(load(LogbookFactory.class));
+
+    Logbook create(@Nullable final HttpLogFormatter formatter,
+                @Nullable final HttpLogWriter writer,
+                @Nullable final Predicate<RawHttpRequest> predicate,
+                @Nullable final Obfuscator headerObfuscator,
+                @Nullable final Obfuscator parameterObfuscator,
+                @Nullable final BodyObfuscator bodyObfuscator);
+
+}
diff --git a/logbook-core/src/main/java/org/zalando/logbook/Obfuscator.java b/logbook-api/src/main/java/org/zalando/logbook/Obfuscator.java
similarity index 100%
rename from logbook-core/src/main/java/org/zalando/logbook/Obfuscator.java
rename to logbook-api/src/main/java/org/zalando/logbook/Obfuscator.java
diff --git a/logbook-core/src/main/java/org/zalando/logbook/Origin.java b/logbook-api/src/main/java/org/zalando/logbook/Origin.java
similarity index 97%
rename from logbook-core/src/main/java/org/zalando/logbook/Origin.java
rename to logbook-api/src/main/java/org/zalando/logbook/Origin.java
index 46778a96..bb263554 100644
--- a/logbook-core/src/main/java/org/zalando/logbook/Origin.java
+++ b/logbook-api/src/main/java/org/zalando/logbook/Origin.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: API
  * %%
  * Copyright (C) 2015 - 2016 Zalando SE
  * %%
diff --git a/logbook-core/src/main/java/org/zalando/logbook/Precorrelation.java b/logbook-api/src/main/java/org/zalando/logbook/Precorrelation.java
similarity index 97%
rename from logbook-core/src/main/java/org/zalando/logbook/Precorrelation.java
rename to logbook-api/src/main/java/org/zalando/logbook/Precorrelation.java
index 20f38bd5..4d803890 100644
--- a/logbook-core/src/main/java/org/zalando/logbook/Precorrelation.java
+++ b/logbook-api/src/main/java/org/zalando/logbook/Precorrelation.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: API
  * %%
  * Copyright (C) 2015 Zalando SE
  * %%
diff --git a/logbook-core/src/main/java/org/zalando/logbook/RawHttpRequest.java b/logbook-api/src/main/java/org/zalando/logbook/RawHttpRequest.java
similarity index 97%
rename from logbook-core/src/main/java/org/zalando/logbook/RawHttpRequest.java
rename to logbook-api/src/main/java/org/zalando/logbook/RawHttpRequest.java
index e6d4e983..4dd79c25 100644
--- a/logbook-core/src/main/java/org/zalando/logbook/RawHttpRequest.java
+++ b/logbook-api/src/main/java/org/zalando/logbook/RawHttpRequest.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: API
  * %%
  * Copyright (C) 2015 Zalando SE
  * %%
diff --git a/logbook-core/src/main/java/org/zalando/logbook/RawHttpResponse.java b/logbook-api/src/main/java/org/zalando/logbook/RawHttpResponse.java
similarity index 97%
rename from logbook-core/src/main/java/org/zalando/logbook/RawHttpResponse.java
rename to logbook-api/src/main/java/org/zalando/logbook/RawHttpResponse.java
index 650e94f6..bb89c62d 100644
--- a/logbook-core/src/main/java/org/zalando/logbook/RawHttpResponse.java
+++ b/logbook-api/src/main/java/org/zalando/logbook/RawHttpResponse.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: API
  * %%
  * Copyright (C) 2015 Zalando SE
  * %%
diff --git a/logbook-core/pom.xml b/logbook-core/pom.xml
index eea0a6dd..7a149ceb 100644
--- a/logbook-core/pom.xml
+++ b/logbook-core/pom.xml
@@ -25,6 +25,10 @@
     </scm>
 
     <dependencies>
+        <dependency>
+            <groupId>org.zalando</groupId>
+            <artifactId>logbook-api</artifactId>
+        </dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
@@ -32,6 +36,10 @@
         </dependency>
 
         <!-- testing -->
+        <dependency>
+            <groupId>org.zalando</groupId>
+            <artifactId>logbook-test</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-nop</artifactId>
diff --git a/logbook-core/src/main/java/org/zalando/logbook/DefaultLogbookFactory.java b/logbook-core/src/main/java/org/zalando/logbook/DefaultLogbookFactory.java
new file mode 100644
index 00000000..e0394f23
--- /dev/null
+++ b/logbook-core/src/main/java/org/zalando/logbook/DefaultLogbookFactory.java
@@ -0,0 +1,48 @@
+package org.zalando.logbook;
+
+/*
+ * #%L
+ * Logbook: Core
+ * %%
+ * Copyright (C) 2015 - 2016 Zalando SE
+ * %%
+ * 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.
+ * #L%
+ */
+
+import javax.annotation.Nullable;
+import java.util.function.Predicate;
+
+import static com.google.common.base.MoreObjects.firstNonNull;
+
+public final class DefaultLogbookFactory implements LogbookFactory {
+
+    @Override
+    public Logbook create(@Nullable HttpLogFormatter formatter, 
+            @Nullable HttpLogWriter writer, 
+            @Nullable Predicate<RawHttpRequest> predicate, 
+            @Nullable Obfuscator headerObfuscator, 
+            @Nullable Obfuscator parameterObfuscator, 
+            @Nullable BodyObfuscator bodyObfuscator) {
+
+        return new DefaultLogbook(
+                firstNonNull(formatter, new DefaultHttpLogFormatter()),
+                firstNonNull(writer, new DefaultHttpLogWriter()),
+                firstNonNull(predicate, request -> true),
+                new Obfuscation(
+                        firstNonNull(headerObfuscator, Obfuscator.authorization()),
+                        firstNonNull(parameterObfuscator, Obfuscator.none()),
+                        firstNonNull(bodyObfuscator, BodyObfuscator.none())));
+    }
+
+}
diff --git a/logbook-core/src/main/resources/META-INF/services/org.zalando.logbook.LogbookFactory b/logbook-core/src/main/resources/META-INF/services/org.zalando.logbook.LogbookFactory
new file mode 100644
index 00000000..9319635b
--- /dev/null
+++ b/logbook-core/src/main/resources/META-INF/services/org.zalando.logbook.LogbookFactory
@@ -0,0 +1,1 @@
+org.zalando.logbook.DefaultLogbookFactory
\ No newline at end of file
diff --git a/logbook-spring-boot-starter/pom.xml b/logbook-spring-boot-starter/pom.xml
index 7ef2dc0f..33492f03 100644
--- a/logbook-spring-boot-starter/pom.xml
+++ b/logbook-spring-boot-starter/pom.xml
@@ -57,6 +57,10 @@
         </dependency>
 
         <!-- testing -->
+        <dependency>
+            <groupId>org.zalando</groupId>
+            <artifactId>logbook-test</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-simple</artifactId>
diff --git a/pom.xml b/pom.xml
index de00203a..60db821e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,10 +52,12 @@
     </developers>
 
     <modules>
+        <module>logbook-api</module>
         <module>logbook-core</module>
         <module>logbook-httpclient</module>
         <module>logbook-servlet</module>
         <module>logbook-spring-boot-starter</module>
+        <module>logbook-test</module>
     </modules>
 
     <properties>
@@ -75,6 +77,11 @@
     <dependencyManagement>
         <dependencies>
             <!-- logbook -->
+            <dependency>
+                <groupId>org.zalando</groupId>
+                <artifactId>logbook-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
             <dependency>
                 <groupId>org.zalando</groupId>
                 <artifactId>logbook-core</artifactId>
@@ -95,6 +102,12 @@
                 <artifactId>logbook-spring-boot-starter</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.zalando</groupId>
+                <artifactId>logbook-test</artifactId>
+                <version>${project.version}</version>
+                <scope>test</scope>
+            </dependency>
 
             <!-- common -->
             <dependency>
@@ -561,4 +574,4 @@
         </profile>
     </profiles>
 
-</project>
\ No newline at end of file
+</project>


Test patch:
diff --git a/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/CustomFormatterTest.java b/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/CustomFormatterTest.java
index 85ed00e2..2a9bcef1 100644
--- a/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/CustomFormatterTest.java
+++ b/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/CustomFormatterTest.java
@@ -29,6 +29,7 @@ import org.springframework.context.annotation.Configuration;
 import org.springframework.test.context.ContextConfiguration;
 import org.zalando.logbook.HttpLogFormatter;
 import org.zalando.logbook.Logbook;
+import org.zalando.logbook.MockRawHttpRequest;
 import org.zalando.logbook.Precorrelation;
 
 import java.io.IOException;
diff --git a/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/CustomWriterTest.java b/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/CustomWriterTest.java
index d85275be..353228e3 100644
--- a/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/CustomWriterTest.java
+++ b/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/CustomWriterTest.java
@@ -27,6 +27,7 @@ import org.springframework.context.annotation.Configuration;
 import org.springframework.test.context.ContextConfiguration;
 import org.zalando.logbook.HttpLogWriter;
 import org.zalando.logbook.Logbook;
+import org.zalando.logbook.MockRawHttpRequest;
 import org.zalando.logbook.RawHttpRequest;
 
 import java.io.IOException;
diff --git a/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/HttpFormatterTest.java b/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/HttpFormatterTest.java
index cf9f30c1..829a0110 100644
--- a/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/HttpFormatterTest.java
+++ b/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/HttpFormatterTest.java
@@ -29,6 +29,7 @@ import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.TestPropertySource;
 import org.zalando.logbook.HttpLogWriter;
 import org.zalando.logbook.Logbook;
+import org.zalando.logbook.MockRawHttpRequest;
 import org.zalando.logbook.Precorrelation;
 
 import java.io.IOException;
@@ -73,7 +74,7 @@ public final class HttpFormatterTest extends AbstractTest {
 
     private Matcher<Precorrelation<String>> isHttpFormatted() {
         final Function<Precorrelation<String>, String> getRequest = Precorrelation::getRequest;
-        return hasFeature("request", getRequest, containsString("GET / HTTP/1.1"));
+        return hasFeature("request", getRequest, containsString("GET http://localhost/ HTTP/1.1"));
     }
 
 }
\ No newline at end of file
diff --git a/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/JsonFormatterTest.java b/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/JsonFormatterTest.java
index 65045717..18f35469 100644
--- a/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/JsonFormatterTest.java
+++ b/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/JsonFormatterTest.java
@@ -28,6 +28,7 @@ import org.springframework.context.annotation.Configuration;
 import org.springframework.test.context.ContextConfiguration;
 import org.zalando.logbook.HttpLogWriter;
 import org.zalando.logbook.Logbook;
+import org.zalando.logbook.MockRawHttpRequest;
 import org.zalando.logbook.Precorrelation;
 
 import java.io.IOException;
diff --git a/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/LevelTest.java b/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/LevelTest.java
index 75bffb7a..6a89afb8 100644
--- a/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/LevelTest.java
+++ b/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/LevelTest.java
@@ -29,6 +29,7 @@ import org.springframework.context.annotation.Configuration;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.TestPropertySource;
 import org.zalando.logbook.Logbook;
+import org.zalando.logbook.MockRawHttpRequest;
 
 import java.io.IOException;
 
diff --git a/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/MockHttpRequest.java b/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/MockHttpRequest.java
deleted file mode 100644
index 2d510ce2..00000000
--- a/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/MockHttpRequest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package org.zalando.logbook.spring;
-
-/*
- * #%L
- * Logbook: Core
- * %%
- * Copyright (C) 2015 Zalando SE
- * %%
- * 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.
- * #L%
- */
-
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.Multimap;
-import lombok.Builder;
-import org.zalando.logbook.HttpRequest;
-import org.zalando.logbook.Origin;
-
-import javax.annotation.Nullable;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-
-import static com.google.common.base.MoreObjects.firstNonNull;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.zalando.logbook.Origin.REMOTE;
-
-public final class MockHttpRequest implements HttpRequest {
-
-    private final Origin origin;
-    private final String remote;
-    private final String method;
-    private final String requestUri;
-    private final Multimap<String, String> headers;
-    private final String contentType;
-    private final Charset charset;
-    private final String body;
-
-    @Builder
-    public MockHttpRequest(@Nullable final Origin origin,
-            @Nullable final String remote,
-            @Nullable final String method,
-            @Nullable final String requestUri,
-            @Nullable final Multimap<String, String> headers,
-            @Nullable final String contentType,
-            @Nullable final Charset charset,
-            @Nullable final String body) {
-        this.origin = firstNonNull(origin, REMOTE);
-        this.remote = firstNonNull(remote, "127.0.0.1");
-        this.method = firstNonNull(method, "GET");
-        this.requestUri = firstNonNull(requestUri, "/");
-        this.headers = firstNonNullNorEmpty(headers, ImmutableMultimap.of());
-        this.contentType = firstNonNull(contentType, "");
-        this.charset = firstNonNull(charset, StandardCharsets.UTF_8);
-        this.body = firstNonNull(body, "");
-    }
-
-    static <K, V> Multimap<K, V> firstNonNullNorEmpty(@Nullable final Multimap<K, V> first, final Multimap<K, V> second) {
-        return first != null && !first.isEmpty() ? first : checkNotNull(second);
-    }
-
-    @Override
-    public Origin getOrigin() {
-        return origin;
-    }
-
-    @Override
-    public String getRemote() {
-        return remote;
-    }
-
-    @Override
-    public String getMethod() {
-        return method;
-    }
-
-    @Override
-    public String getRequestUri() {
-        return requestUri;
-    }
-
-    @Override
-    public Multimap<String, String> getHeaders() {
-        return headers;
-    }
-
-    @Override
-    public String getContentType() {
-        return contentType;
-    }
-
-    @Override
-    public Charset getCharset() {
-        return charset;
-    }
-
-    @Override
-    public byte[] getBody() {
-        return getBodyAsString().getBytes(getCharset());
-    }
-
-    @Override
-    public String getBodyAsString() {
-        return body;
-    }
-
-    static HttpRequest create() {
-        return builder().build();
-    }
-
-}
diff --git a/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/MockRawHttpRequest.java b/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/MockRawHttpRequest.java
deleted file mode 100644
index 1cee1d67..00000000
--- a/logbook-spring-boot-starter/src/test/java/org/zalando/logbook/spring/MockRawHttpRequest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.zalando.logbook.spring;
-
-/*
- * #%L
- * Logbook: Core
- * %%
- * Copyright (C) 2015 Zalando SE
- * %%
- * 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.
- * #L%
- */
-
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.Multimap;
-import lombok.Builder;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Value;
-import org.zalando.logbook.HttpRequest;
-import org.zalando.logbook.Origin;
-import org.zalando.logbook.RawHttpRequest;
-
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-
-@Value
-@Getter
-@Builder
-@NoArgsConstructor(staticName = "create")
-public class MockRawHttpRequest implements RawHttpRequest {
-
-    private Multimap<String, String> headers = ImmutableMultimap.of();
-    private String contentType = "";
-    private Charset charset = StandardCharsets.UTF_8;
-    private Origin origin = Origin.REMOTE;
-    private String remote = "127.0.0.1";
-    private String method = "GET";
-    private String requestUri = "/";
-
-    @Override
-    public HttpRequest withBody() throws IOException {
-        return MockHttpRequest.builder()
-                .headers(headers)
-                .contentType(contentType)
-                .charset(charset)
-                .origin(origin)
-                .remote(remote)
-                .method(method)
-                .requestUri(requestUri)
-                .build();
-    }
-
-}
diff --git a/logbook-test/pom.xml b/logbook-test/pom.xml
new file mode 100644
index 00000000..04f620b2
--- /dev/null
+++ b/logbook-test/pom.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <prerequisites>
+        <maven>3.0.4</maven>
+    </prerequisites>
+
+    <parent>
+        <groupId>org.zalando</groupId>
+        <artifactId>logbook-parent</artifactId>
+        <version>0.15.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>logbook-test</artifactId>
+
+    <name>Logbook: Test</name>
+    <description>HTTP request and response logging</description>
+
+    <scm>
+        <url>https://github.com/zalando/logbook</url>
+        <connection>scm:git:git@github.com:zalando//logbook.git</connection>
+        <developerConnection>scm:git:git@github.com:zalando//logbook.git</developerConnection>
+    </scm>
+
+    <properties>
+        <maven.deploy.skip>true</maven.deploy.skip>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.zalando</groupId>
+            <artifactId>logbook-api</artifactId>
+        </dependency>
+    </dependencies>
+
+    <distributionManagement>
+        <snapshotRepository>
+            <id>ossrh</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+        </snapshotRepository>
+        <repository>
+            <id>ossrh</id>
+            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
+        </repository>
+    </distributionManagement>
+
+</project>
diff --git a/logbook-core/src/test/java/org/zalando/logbook/MockHttpRequest.java b/logbook-test/src/main/java/org/zalando/logbook/MockHttpRequest.java
similarity index 99%
rename from logbook-core/src/test/java/org/zalando/logbook/MockHttpRequest.java
rename to logbook-test/src/main/java/org/zalando/logbook/MockHttpRequest.java
index 09856721..7c012299 100644
--- a/logbook-core/src/test/java/org/zalando/logbook/MockHttpRequest.java
+++ b/logbook-test/src/main/java/org/zalando/logbook/MockHttpRequest.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: Test
  * %%
  * Copyright (C) 2015 Zalando SE
  * %%
diff --git a/logbook-core/src/test/java/org/zalando/logbook/MockHttpResponse.java b/logbook-test/src/main/java/org/zalando/logbook/MockHttpResponse.java
similarity index 99%
rename from logbook-core/src/test/java/org/zalando/logbook/MockHttpResponse.java
rename to logbook-test/src/main/java/org/zalando/logbook/MockHttpResponse.java
index 2864d2a5..0cc41395 100644
--- a/logbook-core/src/test/java/org/zalando/logbook/MockHttpResponse.java
+++ b/logbook-test/src/main/java/org/zalando/logbook/MockHttpResponse.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: Test
  * %%
  * Copyright (C) 2015 Zalando SE
  * %%
diff --git a/logbook-core/src/test/java/org/zalando/logbook/MockRawHttpRequest.java b/logbook-test/src/main/java/org/zalando/logbook/MockRawHttpRequest.java
similarity index 98%
rename from logbook-core/src/test/java/org/zalando/logbook/MockRawHttpRequest.java
rename to logbook-test/src/main/java/org/zalando/logbook/MockRawHttpRequest.java
index 47e5b451..31e0bde0 100644
--- a/logbook-core/src/test/java/org/zalando/logbook/MockRawHttpRequest.java
+++ b/logbook-test/src/main/java/org/zalando/logbook/MockRawHttpRequest.java
@@ -2,7 +2,7 @@ package org.zalando.logbook;
 
 /*
  * #%L
- * Logbook: Core
+ * Logbook: Test
  * %%
  * Copyright (C) 2015 Zalando SE
  * %%
@@ -112,7 +112,7 @@ public final class MockRawHttpRequest implements RawHttpRequest {
                 .build();
     }
 
-    static RawHttpRequest create() {
+    public static RawHttpRequest create() {
         return builder().build();
     }