Remove package tangle caused by RestDocumentationException

This commit is contained in:
Andy Wilkinson
2015-04-29 09:37:11 +01:00
parent 37f9f02580
commit 9749ec18eb
6 changed files with 22 additions and 22 deletions

View File

@@ -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));

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -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]"));

View File

@@ -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}")));

View File

@@ -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:"));