diff --git a/spring-restdocs/src/main/java/org/springframework/restdocs/hypermedia/LinkSnippetResultHandler.java b/spring-restdocs/src/main/java/org/springframework/restdocs/hypermedia/LinkSnippetResultHandler.java index 0940ccfb..a86c2265 100644 --- a/spring-restdocs/src/main/java/org/springframework/restdocs/hypermedia/LinkSnippetResultHandler.java +++ b/spring-restdocs/src/main/java/org/springframework/restdocs/hypermedia/LinkSnippetResultHandler.java @@ -24,8 +24,8 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import org.springframework.restdocs.RestDocumentationException; import org.springframework.restdocs.snippet.DocumentationWriter; +import org.springframework.restdocs.snippet.SnippetGenerationException; import org.springframework.restdocs.snippet.DocumentationWriter.TableAction; import org.springframework.restdocs.snippet.DocumentationWriter.TableWriter; import org.springframework.restdocs.snippet.SnippetWritingResultHandler; @@ -99,7 +99,7 @@ public class LinkSnippetResultHandler extends SnippetWritingResultHandler { message += "Links with the following relations were not found in the response: " + missingRels; } - throw new RestDocumentationException(message); + throw new SnippetGenerationException(message); } Assert.isTrue(actualRels.equals(expectedRels)); diff --git a/spring-restdocs/src/main/java/org/springframework/restdocs/payload/FieldValidator.java b/spring-restdocs/src/main/java/org/springframework/restdocs/payload/FieldValidator.java index e8de809f..4404ff68 100644 --- a/spring-restdocs/src/main/java/org/springframework/restdocs/payload/FieldValidator.java +++ b/spring-restdocs/src/main/java/org/springframework/restdocs/payload/FieldValidator.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import org.springframework.restdocs.RestDocumentationException; +import org.springframework.restdocs.snippet.SnippetGenerationException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -63,7 +63,7 @@ class FieldValidator { message += "Fields with the following paths were not found in the payload: " + missingFields; } - throw new RestDocumentationException(message); + throw new SnippetGenerationException(message); } } diff --git a/spring-restdocs/src/main/java/org/springframework/restdocs/RestDocumentationException.java b/spring-restdocs/src/main/java/org/springframework/restdocs/snippet/SnippetGenerationException.java similarity index 71% rename from spring-restdocs/src/main/java/org/springframework/restdocs/RestDocumentationException.java rename to spring-restdocs/src/main/java/org/springframework/restdocs/snippet/SnippetGenerationException.java index f63c1f22..027d8282 100644 --- a/spring-restdocs/src/main/java/org/springframework/restdocs/RestDocumentationException.java +++ b/spring-restdocs/src/main/java/org/springframework/restdocs/snippet/SnippetGenerationException.java @@ -14,23 +14,23 @@ * limitations under the License. */ -package org.springframework.restdocs; +package org.springframework.restdocs.snippet; /** - * A {@link RuntimeException} thrown to indicate a problem with a RESTful resource's - * documentation. + * A {@link RuntimeException} thrown to indicate a problem with the generation of a + * documentation snippet. * * @author Andy Wilkinson */ @SuppressWarnings("serial") -public class RestDocumentationException extends RuntimeException { +public class SnippetGenerationException extends RuntimeException { /** - * Creates a new {@code RestDocumentationException} described by the given + * Creates a new {@code SnippetGenerationException} described by the given * {@code message} - * @param message the message that describes the documentation problem + * @param message the message that describes the problem */ - public RestDocumentationException(String message) { + public SnippetGenerationException(String message) { super(message); } diff --git a/spring-restdocs/src/test/java/org/springframework/restdocs/hypermedia/HypermediaDocumentationTests.java b/spring-restdocs/src/test/java/org/springframework/restdocs/hypermedia/HypermediaDocumentationTests.java index 0eb38b2a..8f7df315 100644 --- a/spring-restdocs/src/test/java/org/springframework/restdocs/hypermedia/HypermediaDocumentationTests.java +++ b/spring-restdocs/src/test/java/org/springframework/restdocs/hypermedia/HypermediaDocumentationTests.java @@ -27,7 +27,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.springframework.mock.web.MockHttpServletResponse; -import org.springframework.restdocs.RestDocumentationException; +import org.springframework.restdocs.snippet.SnippetGenerationException; import org.springframework.restdocs.test.ExpectedSnippet; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; @@ -47,7 +47,7 @@ public class HypermediaDocumentationTests { @Test public void undocumentedLink() throws IOException { - this.thrown.expect(RestDocumentationException.class); + this.thrown.expect(SnippetGenerationException.class); this.thrown.expectMessage(equalTo("Links with the following relations were not" + " documented: [foo]")); documentLinks("undocumented-link", @@ -57,7 +57,7 @@ public class HypermediaDocumentationTests { @Test public void missingLink() throws IOException { - this.thrown.expect(RestDocumentationException.class); + this.thrown.expect(SnippetGenerationException.class); this.thrown.expectMessage(equalTo("Links with the following relations were not" + " found in the response: [foo]")); documentLinks("undocumented-link", new StubLinkExtractor(), @@ -66,7 +66,7 @@ public class HypermediaDocumentationTests { @Test public void undocumentedLinkAndMissingLink() throws IOException { - this.thrown.expect(RestDocumentationException.class); + this.thrown.expect(SnippetGenerationException.class); this.thrown.expectMessage(equalTo("Links with the following relations were not" + " documented: [a]. Links with the following relations were not" + " found in the response: [foo]")); diff --git a/spring-restdocs/src/test/java/org/springframework/restdocs/payload/FieldValidatorTests.java b/spring-restdocs/src/test/java/org/springframework/restdocs/payload/FieldValidatorTests.java index 2706a832..081e3be5 100644 --- a/spring-restdocs/src/test/java/org/springframework/restdocs/payload/FieldValidatorTests.java +++ b/spring-restdocs/src/test/java/org/springframework/restdocs/payload/FieldValidatorTests.java @@ -24,7 +24,7 @@ import java.util.Arrays; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.springframework.restdocs.RestDocumentationException; +import org.springframework.restdocs.snippet.SnippetGenerationException; /** * Tests for {@link FieldValidator} @@ -70,7 +70,7 @@ public class FieldValidatorTests { @Test public void missingField() throws IOException { - this.thrownException.expect(RestDocumentationException.class); + this.thrownException.expect(SnippetGenerationException.class); this.thrownException .expectMessage(equalTo("Fields with the following paths were not found" + " in the payload: [y, z]")); @@ -81,7 +81,7 @@ public class FieldValidatorTests { @Test public void undocumentedField() throws IOException { - this.thrownException.expect(RestDocumentationException.class); + this.thrownException.expect(SnippetGenerationException.class); this.thrownException.expectMessage(equalTo(String .format("The following parts of the payload were not" + " documented:%n{%n \"a\" : {%n \"c\" : true%n }%n}"))); diff --git a/spring-restdocs/src/test/java/org/springframework/restdocs/payload/PayloadDocumentationTests.java b/spring-restdocs/src/test/java/org/springframework/restdocs/payload/PayloadDocumentationTests.java index fd3be61f..38a8d38c 100644 --- a/spring-restdocs/src/test/java/org/springframework/restdocs/payload/PayloadDocumentationTests.java +++ b/spring-restdocs/src/test/java/org/springframework/restdocs/payload/PayloadDocumentationTests.java @@ -31,7 +31,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.springframework.mock.web.MockHttpServletResponse; -import org.springframework.restdocs.RestDocumentationException; +import org.springframework.restdocs.snippet.SnippetGenerationException; import org.springframework.restdocs.test.ExpectedSnippet; /** @@ -89,7 +89,7 @@ public class PayloadDocumentationTests { @Test public void undocumentedRequestField() throws IOException { - this.thrown.expect(RestDocumentationException.class); + this.thrown.expect(SnippetGenerationException.class); this.thrown .expectMessage(startsWith("The following parts of the payload were not" + " documented:")); @@ -99,7 +99,7 @@ public class PayloadDocumentationTests { @Test public void missingRequestField() throws IOException { - this.thrown.expect(RestDocumentationException.class); + this.thrown.expect(SnippetGenerationException.class); this.thrown .expectMessage(equalTo("Fields with the following paths were not found" + " in the payload: [a.b]")); @@ -110,7 +110,7 @@ public class PayloadDocumentationTests { @Test public void undocumentedRequestFieldAndMissingRequestField() throws IOException { - this.thrown.expect(RestDocumentationException.class); + this.thrown.expect(SnippetGenerationException.class); this.thrown .expectMessage(startsWith("The following parts of the payload were not" + " documented:"));