Upgrade to Spring Java Format 0.0.38

Closes gh-890
This commit is contained in:
Andy Wilkinson
2023-05-11 17:51:45 +01:00
parent 24ad0a829f
commit e741790f02
142 changed files with 2994 additions and 2090 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2021 the original author or authors.
* Copyright 2014-2023 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.
@@ -40,9 +40,11 @@ public class CustomUriConfiguration {
// tag::custom-uri-configuration[]
@Before
public void setUp() {
this.webTestClient = WebTestClient.bindToApplicationContext(this.context).configureClient()
.baseUrl("https://api.example.com") // <1>
.filter(documentationConfiguration(this.restDocumentation)).build();
this.webTestClient = WebTestClient.bindToApplicationContext(this.context)
.configureClient()
.baseUrl("https://api.example.com") // <1>
.filter(documentationConfiguration(this.restDocumentation))
.build();
}
// end::custom-uri-configuration[]

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2023 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.
@@ -35,9 +35,10 @@ class ExampleApplicationJUnit5Tests {
@BeforeEach
void setUp(ApplicationContext applicationContext, RestDocumentationContextProvider restDocumentation) {
this.webTestClient = WebTestClient.bindToApplicationContext(applicationContext).configureClient()
.filter(documentationConfiguration(restDocumentation)) // <1>
.build();
this.webTestClient = WebTestClient.bindToApplicationContext(applicationContext)
.configureClient()
.filter(documentationConfiguration(restDocumentation)) // <1>
.build();
}
// end::setup[]

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2021 the original author or authors.
* Copyright 2014-2023 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.
@@ -41,9 +41,10 @@ public class ExampleApplicationTestNgTests {
@BeforeMethod
public void setUp(Method method) {
this.webTestClient = WebTestClient.bindToApplicationContext(this.context).configureClient()
.filter(documentationConfiguration(this.restDocumentation)) // <1>
.build();
this.webTestClient = WebTestClient.bindToApplicationContext(this.context)
.configureClient()
.filter(documentationConfiguration(this.restDocumentation)) // <1>
.build();
this.restDocumentation.beforeTest(getClass(), method.getName());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2021 the original author or authors.
* Copyright 2014-2023 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.
@@ -40,9 +40,10 @@ public class ExampleApplicationTests {
@Before
public void setUp() {
this.webTestClient = WebTestClient.bindToApplicationContext(this.context).configureClient()
.filter(documentationConfiguration(this.restDocumentation)) // <1>
.build();
this.webTestClient = WebTestClient.bindToApplicationContext(this.context)
.configureClient()
.filter(documentationConfiguration(this.restDocumentation)) // <1>
.build();
}
// end::setup[]

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2023 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.
@@ -30,20 +30,31 @@ public class Hypermedia {
public void defaultExtractor() {
// tag::links[]
this.webTestClient.get().uri("/").accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isOk()
.expectBody().consumeWith(document("index", links(// <1>
linkWithRel("alpha").description("Link to the alpha resource"), // <2>
linkWithRel("bravo").description("Link to the bravo resource")))); // <3>
this.webTestClient.get()
.uri("/")
.accept(MediaType.APPLICATION_JSON)
.exchange()
.expectStatus()
.isOk()
.expectBody()
.consumeWith(document("index", links(// <1>
linkWithRel("alpha").description("Link to the alpha resource"), // <2>
linkWithRel("bravo").description("Link to the bravo resource")))); // <3>
// end::links[]
}
public void explicitExtractor() {
this.webTestClient.get().uri("/").accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isOk()
.expectBody()
// tag::explicit-extractor[]
.consumeWith(document("index", links(halLinks(), // <1>
linkWithRel("alpha").description("Link to the alpha resource"),
linkWithRel("bravo").description("Link to the bravo resource"))));
this.webTestClient.get()
.uri("/")
.accept(MediaType.APPLICATION_JSON)
.exchange()
.expectStatus()
.isOk()
.expectBody()
// tag::explicit-extractor[]
.consumeWith(document("index", links(halLinks(), // <1>
linkWithRel("alpha").description("Link to the alpha resource"),
linkWithRel("bravo").description("Link to the bravo resource"))));
// end::explicit-extractor[]
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2023 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,14 @@ public class InvokeService {
public void invokeService() {
// tag::invoke-service[]
this.webTestClient.get().uri("/").accept(MediaType.APPLICATION_JSON) // <1>
.exchange().expectStatus().isOk() // <2>
.expectBody().consumeWith(document("index")); // <3>
this.webTestClient.get()
.uri("/")
.accept(MediaType.APPLICATION_JSON) // <1>
.exchange()
.expectStatus()
.isOk() // <2>
.expectBody()
.consumeWith(document("index")); // <3>
// end::invoke-service[]
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2021 the original author or authors.
* Copyright 2014-2023 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.
@@ -41,9 +41,11 @@ public class ParameterizedOutput {
// tag::parameterized-output[]
@Before
public void setUp() {
this.webTestClient = WebTestClient.bindToApplicationContext(this.context).configureClient()
.filter(documentationConfiguration(this.restDocumentation))
.entityExchangeResultConsumer(document("{method-name}/{step}")).build();
this.webTestClient = WebTestClient.bindToApplicationContext(this.context)
.configureClient()
.filter(documentationConfiguration(this.restDocumentation))
.entityExchangeResultConsumer(document("{method-name}/{step}"))
.build();
}
// end::parameterized-output[]