Remove redundant throws declarations from non public API

Closes gh-828
This commit is contained in:
Andy Wilkinson
2022-07-15 12:38:25 +01:00
parent 6ab923b470
commit ebe70a91c7
45 changed files with 228 additions and 237 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -54,7 +54,7 @@ public class EveryTestPreprocessing {
}
// end::setup[]
public void use() throws Exception {
public void use() {
// tag::use[]
this.webTestClient.get().uri("/").exchange().expectStatus().isOk()
.expectBody().consumeWith(document("index",

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017 the original author or authors.
* Copyright 2014-2022 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.
@@ -29,7 +29,7 @@ public class HttpHeaders {
private WebTestClient webTestClient;
public void headers() throws Exception {
public void headers() {
// tag::headers[]
this.webTestClient
.get().uri("/people").header("Authorization", "Basic dXNlcjpzZWNyZXQ=") // <1>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2021 the original author or authors.
* Copyright 2014-2022 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.
@@ -28,7 +28,7 @@ public class Hypermedia {
private WebTestClient webTestClient;
public void defaultExtractor() throws Exception {
public void defaultExtractor() {
// tag::links[]
this.webTestClient.get().uri("/").accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isOk()
.expectBody().consumeWith(document("index", links(// <1>
@@ -37,7 +37,7 @@ public class Hypermedia {
// end::links[]
}
public void explicitExtractor() throws Exception {
public void explicitExtractor() {
this.webTestClient.get().uri("/").accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isOk()
.expectBody()
// tag::explicit-extractor[]

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017 the original author or authors.
* Copyright 2014-2022 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.
@@ -25,7 +25,7 @@ public class InvokeService {
private WebTestClient webTestClient;
public void invokeService() throws Exception {
public void invokeService() {
// tag::invoke-service[]
this.webTestClient.get().uri("/").accept(MediaType.APPLICATION_JSON) // <1>
.exchange().expectStatus().isOk() // <2>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017 the original author or authors.
* Copyright 2014-2022 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.
@@ -28,7 +28,7 @@ public class PathParameters {
private WebTestClient webTestClient;
public void pathParametersSnippet() throws Exception {
public void pathParametersSnippet() {
// tag::path-parameters[]
this.webTestClient.get().uri("/locations/{latitude}/{longitude}", 51.5072, 0.1275) // <1>
.exchange().expectStatus().isOk().expectBody()

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017 the original author or authors.
* Copyright 2014-2022 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.
@@ -37,7 +37,7 @@ public class Payload {
private WebTestClient webTestClient;
public void response() throws Exception {
public void response() {
// tag::response[]
this.webTestClient.get().uri("user/5").accept(MediaType.APPLICATION_JSON)
.exchange().expectStatus().isOk().expectBody()
@@ -48,7 +48,7 @@ public class Payload {
// end::response[]
}
public void subsection() throws Exception {
public void subsection() {
// tag::subsection[]
this.webTestClient.get().uri("user/5").accept(MediaType.APPLICATION_JSON)
.exchange().expectStatus().isOk().expectBody()
@@ -58,7 +58,7 @@ public class Payload {
// end::subsection[]
}
public void explicitType() throws Exception {
public void explicitType() {
this.webTestClient.get().uri("user/5").accept(MediaType.APPLICATION_JSON)
.exchange().expectStatus().isOk().expectBody()
// tag::explicit-type[]
@@ -70,7 +70,7 @@ public class Payload {
// end::explicit-type[]
}
public void constraints() throws Exception {
public void constraints() {
this.webTestClient.get().uri("user/5").accept(MediaType.APPLICATION_JSON)
.exchange().expectStatus().isOk().expectBody()
// tag::constraints[]
@@ -86,7 +86,7 @@ public class Payload {
// end::constraints[]
}
public void descriptorReuse() throws Exception {
public void descriptorReuse() {
FieldDescriptor[] book = new FieldDescriptor[] {
fieldWithPath("title").description("Title of the book"),
fieldWithPath("author").description("Author of the book") };
@@ -109,7 +109,7 @@ public class Payload {
// end::book-array[]
}
public void fieldsSubsection() throws Exception {
public void fieldsSubsection() {
// tag::fields-subsection[]
this.webTestClient.get().uri("/locations/1").accept(MediaType.APPLICATION_JSON)
.exchange().expectStatus().isOk().expectBody()
@@ -120,7 +120,7 @@ public class Payload {
// end::fields-subsection[]
}
public void bodySubsection() throws Exception {
public void bodySubsection() {
// tag::body-subsection[]
this.webTestClient.get().uri("/locations/1").accept(MediaType.APPLICATION_JSON)
.exchange().expectStatus().isOk().expectBody()

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017 the original author or authors.
* Copyright 2014-2022 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.
@@ -31,7 +31,7 @@ public class RequestParameters {
private WebTestClient webTestClient;
public void getQueryStringSnippet() throws Exception {
public void getQueryStringSnippet() {
// tag::request-parameters-query-string[]
this.webTestClient.get().uri("/users?page=2&per_page=100") // <1>
.exchange().expectStatus().isOk().expectBody()
@@ -42,7 +42,7 @@ public class RequestParameters {
// end::request-parameters-query-string[]
}
public void postFormDataSnippet() throws Exception {
public void postFormDataSnippet() {
// tag::request-parameters-form-data[]
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
formData.add("username", "Tester");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017 the original author or authors.
* Copyright 2014-2022 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.
@@ -37,7 +37,7 @@ public class RequestPartPayload {
private WebTestClient webTestClient;
public void fields() throws Exception {
public void fields() {
// tag::fields[]
MultiValueMap<String, Object> multipartData = new LinkedMultiValueMap<>();
Resource imageResource = new ByteArrayResource("<<png data>>".getBytes()) {
@@ -59,7 +59,7 @@ public class RequestPartPayload {
// end::fields[]
}
public void body() throws Exception {
public void body() {
// tag::body[]
MultiValueMap<String, Object> multipartData = new LinkedMultiValueMap<>();
Resource imageResource = new ByteArrayResource("<<png data>>".getBytes()) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017 the original author or authors.
* Copyright 2014-2022 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.
@@ -31,7 +31,7 @@ public class RequestParts {
private WebTestClient webTestClient;
public void upload() throws Exception {
public void upload() {
// tag::request-parts[]
MultiValueMap<String, Object> multipartData = new LinkedMultiValueMap<>();
multipartData.add("file", "example".getBytes());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017 the original author or authors.
* Copyright 2014-2022 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,7 +30,7 @@ public class WebTestClientSnippetReuse extends SnippetReuse {
private WebTestClient webTestClient;
public void documentation() throws Exception {
public void documentation() {
// tag::use[]
this.webTestClient.get().uri("/").accept(MediaType.APPLICATION_JSON).exchange()
.expectStatus().isOk().expectBody()