diff --git a/build.gradle b/build.gradle
index 971fc097..acf34a14 100644
--- a/build.gradle
+++ b/build.gradle
@@ -20,6 +20,7 @@ allprojects {
group = 'org.springframework.restdocs'
repositories {
mavenCentral()
+ maven { url 'https://repo.spring.io/milestone' }
}
}
@@ -38,7 +39,7 @@ sonarqube {
}
ext {
- springVersion = '4.3.6.RELEASE'
+ springVersion = '5.0.0.RC1'
javadocLinks = [
'http://docs.oracle.com/javase/8/docs/api/',
"http://docs.spring.io/spring-framework/docs/$springVersion/javadoc-api/",
@@ -64,7 +65,7 @@ subprojects {
mavenBom "org.springframework:spring-framework-bom:$springVersion"
}
dependencies {
- dependency 'com.fasterxml.jackson.core:jackson-databind:2.5.5'
+ dependency 'com.fasterxml.jackson.core:jackson-databind:2.9.0.pr3'
dependency 'com.jayway.restassured:rest-assured:2.8.0'
dependency 'com.samskivert:jmustache:1.12'
dependency 'commons-codec:commons-codec:1.10'
@@ -75,9 +76,9 @@ subprojects {
dependency 'org.asciidoctor:asciidoctorj:1.5.3.1'
dependency 'org.hamcrest:hamcrest-core:1.3'
dependency 'org.hamcrest:hamcrest-library:1.3'
- dependency 'org.hibernate:hibernate-validator:5.2.2.Final'
+ dependency 'org.hibernate:hibernate-validator:5.4.1.Final'
dependency 'org.mockito:mockito-core:1.10.19'
- dependency 'org.springframework.hateoas:spring-hateoas:0.19.0.RELEASE'
+ dependency 'org.springframework.hateoas:spring-hateoas:0.23.0.RELEASE'
dependency 'org.jacoco:org.jacoco.agent:0.7.7.201606060606'
}
}
diff --git a/docs/src/docs/asciidoc/getting-started.adoc b/docs/src/docs/asciidoc/getting-started.adoc
index a70d92f4..42186c32 100644
--- a/docs/src/docs/asciidoc/getting-started.adoc
+++ b/docs/src/docs/asciidoc/getting-started.adoc
@@ -68,7 +68,7 @@ If you want to jump straight in, a number of sample applications are available:
Spring REST Docs has the following minimum requirements:
- Java 8
-- Spring Framework 4.3
+- Spring Framework 5
Additionally, the `spring-restdocs-restassured` module has the following minimum
requirements:
diff --git a/docs/src/test/java/com/example/mockmvc/RequestParts.java b/docs/src/test/java/com/example/mockmvc/RequestParts.java
index 90210d50..c78e6162 100644
--- a/docs/src/test/java/com/example/mockmvc/RequestParts.java
+++ b/docs/src/test/java/com/example/mockmvc/RequestParts.java
@@ -21,7 +21,7 @@ import org.springframework.test.web.servlet.MockMvc;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.restdocs.request.RequestDocumentation.partWithName;
import static org.springframework.restdocs.request.RequestDocumentation.requestParts;
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.fileUpload;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.multipart;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
public class RequestParts {
@@ -30,7 +30,7 @@ public class RequestParts {
public void upload() throws Exception {
// tag::request-parts[]
- this.mockMvc.perform(fileUpload("/upload").file("file", "example".getBytes())) // <1>
+ this.mockMvc.perform(multipart("/upload").file("file", "example".getBytes())) // <1>
.andExpect(status().isOk())
.andDo(document("upload", requestParts( // <2>
partWithName("file").description("The file to upload")) // <3>
diff --git a/samples/rest-assured/build.gradle b/samples/rest-assured/build.gradle
index 2ec2bc0d..f7934baa 100644
--- a/samples/rest-assured/build.gradle
+++ b/samples/rest-assured/build.gradle
@@ -1,9 +1,9 @@
buildscript {
repositories {
- mavenCentral()
+ maven { url 'https://repo.spring.io/milestone' }
}
dependencies {
- classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.5.3.RELEASE'
+ classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M1'
}
}
@@ -12,8 +12,9 @@ plugins {
}
apply plugin: 'java'
-apply plugin: 'spring-boot'
+apply plugin: 'org.springframework.boot'
apply plugin: 'eclipse'
+apply plugin: 'io.spring.dependency-management'
repositories {
mavenLocal()
diff --git a/samples/rest-assured/src/test/java/com/example/restassured/SampleRestAssuredApplicationTests.java b/samples/rest-assured/src/test/java/com/example/restassured/SampleRestAssuredApplicationTests.java
index 654ab82b..91ef3062 100644
--- a/samples/rest-assured/src/test/java/com/example/restassured/SampleRestAssuredApplicationTests.java
+++ b/samples/rest-assured/src/test/java/com/example/restassured/SampleRestAssuredApplicationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 the original author or authors.
+ * Copyright 2014-2017 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.
@@ -27,9 +27,9 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.restdocs.JUnitRestDocumentation;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
diff --git a/samples/rest-notes-slate/build.gradle b/samples/rest-notes-slate/build.gradle
index 560f68d4..c488bb3e 100644
--- a/samples/rest-notes-slate/build.gradle
+++ b/samples/rest-notes-slate/build.gradle
@@ -1,15 +1,16 @@
buildscript {
repositories {
- mavenCentral()
+ maven { url 'https://repo.spring.io/milestone' }
}
dependencies {
- classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.5.3.RELEASE'
+ classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M1'
}
}
apply plugin: 'java'
-apply plugin: 'spring-boot'
+apply plugin: 'org.springframework.boot'
apply plugin: 'eclipse'
+apply plugin: 'io.spring.dependency-management'
repositories {
mavenLocal()
diff --git a/samples/rest-notes-spring-data-rest/.settings/org.eclipse.jdt.core.prefs b/samples/rest-notes-spring-data-rest/.settings/org.eclipse.jdt.core.prefs
index 30f00a94..ddb7a63a 100644
--- a/samples/rest-notes-spring-data-rest/.settings/org.eclipse.jdt.core.prefs
+++ b/samples/rest-notes-spring-data-rest/.settings/org.eclipse.jdt.core.prefs
@@ -1,15 +1,15 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
diff --git a/samples/rest-notes-spring-data-rest/pom.xml b/samples/rest-notes-spring-data-rest/pom.xml
index 818e1e00..6fe49288 100644
--- a/samples/rest-notes-spring-data-rest/pom.xml
+++ b/samples/rest-notes-spring-data-rest/pom.xml
@@ -11,7 +11,7 @@
org.springframework.boot
spring-boot-starter-parent
- 1.5.3.RELEASE
+ 2.0.0.M1
diff --git a/samples/rest-notes-spring-hateoas/build.gradle b/samples/rest-notes-spring-hateoas/build.gradle
index 2e613b50..68cc359d 100644
--- a/samples/rest-notes-spring-hateoas/build.gradle
+++ b/samples/rest-notes-spring-hateoas/build.gradle
@@ -1,9 +1,9 @@
buildscript {
repositories {
- mavenCentral()
+ maven { url 'https://repo.spring.io/milestone' }
}
dependencies {
- classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.5.3.RELEASE'
+ classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M1'
}
}
@@ -12,8 +12,9 @@ plugins {
}
apply plugin: 'java'
-apply plugin: 'spring-boot'
+apply plugin: 'org.springframework.boot'
apply plugin: 'eclipse'
+apply plugin: 'io.spring.dependency-management'
repositories {
mavenLocal()
diff --git a/samples/rest-notes-spring-hateoas/src/main/java/com/example/notes/ExceptionSupressingErrorAttributes.java b/samples/rest-notes-spring-hateoas/src/main/java/com/example/notes/ExceptionSupressingErrorAttributes.java
index e8abbe59..bc05ff62 100644
--- a/samples/rest-notes-spring-hateoas/src/main/java/com/example/notes/ExceptionSupressingErrorAttributes.java
+++ b/samples/rest-notes-spring-hateoas/src/main/java/com/example/notes/ExceptionSupressingErrorAttributes.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2017 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.
@@ -18,7 +18,7 @@ package com.example.notes;
import java.util.Map;
-import org.springframework.boot.autoconfigure.web.DefaultErrorAttributes;
+import org.springframework.boot.autoconfigure.web.servlet.error.DefaultErrorAttributes;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes;
diff --git a/samples/rest-notes-spring-hateoas/src/main/java/com/example/notes/NotesController.java b/samples/rest-notes-spring-hateoas/src/main/java/com/example/notes/NotesController.java
index 0eccb0e2..eeb1fb8a 100644
--- a/samples/rest-notes-spring-hateoas/src/main/java/com/example/notes/NotesController.java
+++ b/samples/rest-notes-spring-hateoas/src/main/java/com/example/notes/NotesController.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2017 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.
@@ -87,7 +87,7 @@ public class NotesController {
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
void delete(@PathVariable("id") long id) {
- this.noteRepository.delete(id);
+ this.noteRepository.deleteById(id);
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
diff --git a/samples/rest-notes-spring-hateoas/src/main/java/com/example/notes/TagsController.java b/samples/rest-notes-spring-hateoas/src/main/java/com/example/notes/TagsController.java
index bc22f066..767961cb 100644
--- a/samples/rest-notes-spring-hateoas/src/main/java/com/example/notes/TagsController.java
+++ b/samples/rest-notes-spring-hateoas/src/main/java/com/example/notes/TagsController.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2017 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.
@@ -74,7 +74,7 @@ public class TagsController {
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
void delete(@PathVariable("id") long id) {
- this.repository.delete(id);
+ this.repository.deleteById(id);
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
diff --git a/samples/testng/build.gradle b/samples/testng/build.gradle
index 7386a59c..1a61f1d8 100644
--- a/samples/testng/build.gradle
+++ b/samples/testng/build.gradle
@@ -1,9 +1,9 @@
buildscript {
repositories {
- mavenCentral()
+ maven { url 'https://repo.spring.io/milestone' }
}
dependencies {
- classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.5.3.RELEASE'
+ classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M1'
}
}
@@ -12,8 +12,9 @@ plugins {
}
apply plugin: 'java'
-apply plugin: 'spring-boot'
+apply plugin: 'org.springframework.boot'
apply plugin: 'eclipse'
+apply plugin: 'io.spring.dependency-management'
repositories {
mavenLocal()
diff --git a/spring-restdocs-core/src/main/java/org/springframework/restdocs/headers/AbstractHeadersSnippet.java b/spring-restdocs-core/src/main/java/org/springframework/restdocs/headers/AbstractHeadersSnippet.java
index 22391356..40fb83e1 100644
--- a/spring-restdocs-core/src/main/java/org/springframework/restdocs/headers/AbstractHeadersSnippet.java
+++ b/spring-restdocs-core/src/main/java/org/springframework/restdocs/headers/AbstractHeadersSnippet.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 the original author or authors.
+ * Copyright 2014-2017 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.
@@ -53,8 +53,10 @@ public abstract class AbstractHeadersSnippet extends TemplatedSnippet {
Map attributes) {
super(type + "-headers", attributes);
for (HeaderDescriptor descriptor : descriptors) {
- Assert.notNull(descriptor.getName());
- Assert.notNull(descriptor.getDescription());
+ Assert.notNull(descriptor.getName(),
+ "The name of the header must not be null");
+ Assert.notNull(descriptor.getDescription(),
+ "The description of the header must not be null");
}
this.headerDescriptors = descriptors;
this.type = type;
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/constraints/ResourceBundleConstraintDescriptionResolverTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/constraints/ResourceBundleConstraintDescriptionResolverTests.java
index ece62ab9..25174d1a 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/constraints/ResourceBundleConstraintDescriptionResolverTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/constraints/ResourceBundleConstraintDescriptionResolverTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2017 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.
@@ -270,7 +270,8 @@ public class ResourceBundleConstraintDescriptionResolverTests {
private Constraint getConstraintFromField(String name) {
Annotation[] annotations = ReflectionUtils.findField(Constrained.class, name)
.getAnnotations();
- Assert.isTrue(annotations.length == 1);
+ Assert.isTrue(annotations.length == 1, "The field '" + name + "' must have"
+ + "exactly one @Constrained annotation");
return new Constraint(annotations[0].annotationType().getName(),
AnnotationUtils.getAnnotationAttributes(annotations[0]));
}
diff --git a/spring-restdocs-mockmvc/src/main/java/org/springframework/restdocs/mockmvc/RestDocumentationRequestBuilders.java b/spring-restdocs-mockmvc/src/main/java/org/springframework/restdocs/mockmvc/RestDocumentationRequestBuilders.java
index a4c0300d..3c156082 100644
--- a/spring-restdocs-mockmvc/src/main/java/org/springframework/restdocs/mockmvc/RestDocumentationRequestBuilders.java
+++ b/spring-restdocs-mockmvc/src/main/java/org/springframework/restdocs/mockmvc/RestDocumentationRequestBuilders.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2017 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.
@@ -249,7 +249,7 @@ public abstract class RestDocumentationRequestBuilders {
public static MockMultipartHttpServletRequestBuilder fileUpload(String urlTemplate,
Object... urlVariables) {
return (MockMultipartHttpServletRequestBuilder) MockMvcRequestBuilders
- .fileUpload(urlTemplate, urlVariables)
+ .multipart(urlTemplate, urlVariables)
.requestAttr(RestDocumentationGenerator.ATTRIBUTE_NAME_URL_TEMPLATE,
urlTemplate);
}
@@ -261,7 +261,7 @@ public abstract class RestDocumentationRequestBuilders {
* @return the builder for the file upload request
*/
public static MockMultipartHttpServletRequestBuilder fileUpload(URI uri) {
- return MockMvcRequestBuilders.fileUpload(uri);
+ return MockMvcRequestBuilders.multipart(uri);
}
}
diff --git a/spring-restdocs-mockmvc/src/test/java/org/springframework/restdocs/mockmvc/MockMvcRequestConverterTests.java b/spring-restdocs-mockmvc/src/test/java/org/springframework/restdocs/mockmvc/MockMvcRequestConverterTests.java
index 8b6c67eb..5a5e0a88 100644
--- a/spring-restdocs-mockmvc/src/test/java/org/springframework/restdocs/mockmvc/MockMvcRequestConverterTests.java
+++ b/spring-restdocs-mockmvc/src/test/java/org/springframework/restdocs/mockmvc/MockMvcRequestConverterTests.java
@@ -174,7 +174,7 @@ public class MockMvcRequestConverterTests {
@Test
public void mockMultipartFileUpload() throws Exception {
OperationRequest request = createOperationRequest(
- MockMvcRequestBuilders.fileUpload("/foo")
+ MockMvcRequestBuilders.multipart("/foo")
.file(new MockMultipartFile("file", new byte[] { 1, 2, 3, 4 })));
assertThat(request.getUri(), is(URI.create("http://localhost/foo")));
assertThat(request.getMethod(), is(HttpMethod.POST));
@@ -190,7 +190,7 @@ public class MockMvcRequestConverterTests {
@Test
public void mockMultipartFileUploadWithContentType() throws Exception {
OperationRequest request = createOperationRequest(
- MockMvcRequestBuilders.fileUpload("/foo").file(new MockMultipartFile(
+ MockMvcRequestBuilders.multipart("/foo").file(new MockMultipartFile(
"file", "original", "image/png", new byte[] { 1, 2, 3, 4 })));
assertThat(request.getUri(), is(URI.create("http://localhost/foo")));
assertThat(request.getMethod(), is(HttpMethod.POST));
diff --git a/spring-restdocs-mockmvc/src/test/java/org/springframework/restdocs/mockmvc/MockMvcRestDocumentationIntegrationTests.java b/spring-restdocs-mockmvc/src/test/java/org/springframework/restdocs/mockmvc/MockMvcRestDocumentationIntegrationTests.java
index f4de4f3e..3b6ed629 100644
--- a/spring-restdocs-mockmvc/src/test/java/org/springframework/restdocs/mockmvc/MockMvcRestDocumentationIntegrationTests.java
+++ b/spring-restdocs-mockmvc/src/test/java/org/springframework/restdocs/mockmvc/MockMvcRestDocumentationIntegrationTests.java
@@ -93,7 +93,7 @@ import static org.springframework.restdocs.test.SnippetMatchers.codeBlock;
import static org.springframework.restdocs.test.SnippetMatchers.httpRequest;
import static org.springframework.restdocs.test.SnippetMatchers.httpResponse;
import static org.springframework.restdocs.test.SnippetMatchers.snippet;
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.fileUpload;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.multipart;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@@ -348,7 +348,7 @@ public class MockMvcRestDocumentationIntegrationTests {
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
.apply(documentationConfiguration(this.restDocumentation)).build();
- mockMvc.perform(fileUpload("/upload").file("foo", "bar".getBytes()))
+ mockMvc.perform(multipart("/upload").file("foo", "bar".getBytes()))
.andExpect(status().isOk()).andDo(document("request-parts", requestParts(
partWithName("foo").description("The description"))));
@@ -577,7 +577,7 @@ public class MockMvcRestDocumentationIntegrationTests {
public void multiPart() throws Exception {
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
.apply(documentationConfiguration(this.restDocumentation)).build();
- mockMvc.perform(fileUpload("/upload").file("test", "content".getBytes()))
+ mockMvc.perform(multipart("/upload").file("test", "content".getBytes()))
.andExpect(status().isOk()).andDo(document("upload",
requestParts(partWithName("test").description("Foo"))));
}