Skip to content

Commit 5b22066

Browse files
committed
Applying rewrite to all modules
1 parent 001696e commit 5b22066

19 files changed

Lines changed: 139 additions & 130 deletions

File tree

core/src/test/java/feign/stream/StreamDecoderTest.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,18 @@ class Car {
5757
}
5858

5959
private String carsJson =
60-
"" //
61-
+ "[\n" //
62-
+ " {\n" //
63-
+ " \"name\": \"Megane\",\n" //
64-
+ " \"manufacturer\": \"Renault\"\n" //
65-
+ " },\n" //
66-
+ " {\n" //
67-
+ " \"name\": \"C4\",\n" //
68-
+ " \"manufacturer\": \"Citroën\"\n" //
69-
+ " }\n" //
70-
+ "]\n";
60+
"""
61+
[
62+
{
63+
"name": "Megane",
64+
"manufacturer": "Renault"
65+
},
66+
{
67+
"name": "C4",
68+
"manufacturer": "Citroën"
69+
}
70+
]
71+
""";
7172

7273
@Test
7374
void simpleStreamTest() {

feign-form-spring/src/test/java/feign/form/feign/spring/Dto.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import static lombok.AccessLevel.PRIVATE;
1919

20+
import java.io.Serial;
2021
import java.io.Serializable;
2122
import lombok.AllArgsConstructor;
2223
import lombok.Data;
@@ -30,7 +31,7 @@
3031
@FieldDefaults(level = PRIVATE)
3132
public class Dto implements Serializable {
3233

33-
private static final long serialVersionUID = -4218390863359894943L;
34+
@Serial private static final long serialVersionUID = -4218390863359894943L;
3435

3536
String field1;
3637

feign-form/src/test/java/feign/form/BasicClientTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import feign.jackson.JacksonEncoder;
2828
import java.io.File;
2929
import java.nio.file.Files;
30-
import java.nio.file.Paths;
30+
import java.nio.file.Path;
3131
import java.util.Arrays;
3232
import java.util.Map;
3333
import lombok.val;
@@ -61,7 +61,7 @@ void testFormException() {
6161
@Test
6262
void testUpload() throws Exception {
6363
val path =
64-
Paths.get(Thread.currentThread().getContextClassLoader().getResource("file.txt").toURI());
64+
Path.of(Thread.currentThread().getContextClassLoader().getResource("file.txt").toURI());
6565
assertThat(path).exists();
6666

6767
assertThat(API.upload(path.toFile())).asLong().isEqualTo(Files.size(path));
@@ -70,7 +70,7 @@ void testUpload() throws Exception {
7070
@Test
7171
void testUploadWithParam() throws Exception {
7272
val path =
73-
Paths.get(Thread.currentThread().getContextClassLoader().getResource("file.txt").toURI());
73+
Path.of(Thread.currentThread().getContextClassLoader().getResource("file.txt").toURI());
7474
assertThat(path).exists();
7575

7676
assertThat(API.upload(10, Boolean.TRUE, path.toFile())).asLong().isEqualTo(Files.size(path));
@@ -94,11 +94,11 @@ void testQueryMap() {
9494
@Test
9595
void testMultipleFilesArray() throws Exception {
9696
val path1 =
97-
Paths.get(Thread.currentThread().getContextClassLoader().getResource("file.txt").toURI());
97+
Path.of(Thread.currentThread().getContextClassLoader().getResource("file.txt").toURI());
9898
assertThat(path1).exists();
9999

100100
val path2 =
101-
Paths.get(
101+
Path.of(
102102
Thread.currentThread().getContextClassLoader().getResource("another_file.txt").toURI());
103103
assertThat(path2).exists();
104104

@@ -110,11 +110,11 @@ void testMultipleFilesArray() throws Exception {
110110
@Test
111111
void testMultipleFilesList() throws Exception {
112112
val path1 =
113-
Paths.get(Thread.currentThread().getContextClassLoader().getResource("file.txt").toURI());
113+
Path.of(Thread.currentThread().getContextClassLoader().getResource("file.txt").toURI());
114114
assertThat(path1).exists();
115115

116116
val path2 =
117-
Paths.get(
117+
Path.of(
118118
Thread.currentThread().getContextClassLoader().getResource("another_file.txt").toURI());
119119
assertThat(path2).exists();
120120

@@ -128,7 +128,7 @@ void testUploadWithDto() throws Exception {
128128
val dto = new Dto("Artem", 11);
129129

130130
val path =
131-
Paths.get(Thread.currentThread().getContextClassLoader().getResource("file.txt").toURI());
131+
Path.of(Thread.currentThread().getContextClassLoader().getResource("file.txt").toURI());
132132
assertThat(path).exists();
133133

134134
assertThat(API.uploadWithDto(dto, path.toFile()))
@@ -140,7 +140,7 @@ void testUploadWithDto() throws Exception {
140140
@Test
141141
void testUnknownTypeFile() throws Exception {
142142
val path =
143-
Paths.get(Thread.currentThread().getContextClassLoader().getResource("file.abc").toURI());
143+
Path.of(Thread.currentThread().getContextClassLoader().getResource("file.abc").toURI());
144144
assertThat(path).exists();
145145

146146
assertThat(API.uploadUnknownType(path.toFile())).isEqualTo("application/octet-stream");

feign-form/src/test/java/feign/form/Dto.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import static lombok.AccessLevel.PRIVATE;
1919

20+
import java.io.Serial;
2021
import java.io.Serializable;
2122
import lombok.AllArgsConstructor;
2223
import lombok.Data;
@@ -29,7 +30,7 @@
2930
@FieldDefaults(level = PRIVATE)
3031
class Dto implements Serializable {
3132

32-
private static final long serialVersionUID = 4743133513526293872L;
33+
@Serial private static final long serialVersionUID = 4743133513526293872L;
3334

3435
String name;
3536

gson/src/test/java/feign/gson/GsonCodecTest.java

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ void encodesMapObjectNumericalValuesAsInteger() {
4949
new GsonEncoder().encode(map, map.getClass(), template);
5050

5151
assertThat(template)
52-
.hasBody(
53-
"" //
54-
+ "{\n" //
55-
+ " \"foo\": 1\n" //
56-
+ "}");
52+
.hasBody("""
53+
{
54+
"foo": 1
55+
}\
56+
""");
5757
}
5858

5959
@Test
@@ -87,14 +87,15 @@ void encodesFormParams() {
8787

8888
assertThat(template)
8989
.hasBody(
90-
"" //
91-
+ "{\n" //
92-
+ " \"foo\": 1,\n" //
93-
+ " \"bar\": [\n" //
94-
+ " 2,\n" //
95-
+ " 3\n" //
96-
+ " ]\n" //
97-
+ "}");
90+
"""
91+
{
92+
"foo": 1,
93+
"bar": [
94+
2,
95+
3
96+
]
97+
}\
98+
""");
9899
}
99100

100101
static class Zone extends LinkedHashMap<String, Object> {
@@ -165,16 +166,17 @@ void emptyBodyDecodesToNull() throws Exception {
165166
}
166167

167168
private String zonesJson =
168-
"" //
169-
+ "[\n" //
170-
+ " {\n" //
171-
+ " \"name\": \"denominator.io.\"\n" //
172-
+ " },\n" //
173-
+ " {\n" //
174-
+ " \"name\": \"denominator.io.\",\n" //
175-
+ " \"id\": \"ABCD\"\n" //
176-
+ " }\n" //
177-
+ "]\n";
169+
"""
170+
[
171+
{
172+
"name": "denominator.io."
173+
},
174+
{
175+
"name": "denominator.io.",
176+
"id": "ABCD"
177+
}
178+
]
179+
""";
178180

179181
final TypeAdapter upperZone =
180182
new TypeAdapter<Zone>() {
@@ -233,16 +235,16 @@ void customEncoder() {
233235

234236
assertThat(template)
235237
.hasBody(
236-
"" //
237-
+ "[\n" //
238-
+ " {\n" //
239-
+ " \"name\": \"DENOMINATOR.IO.\"\n" //
240-
+ " },\n" //
241-
+ " {\n" //
242-
+ " \"name\": \"DENOMINATOR.IO.\",\n" //
243-
+ " \"id\": \"ABCD\"\n" //
244-
+ " }\n" //
245-
+ "]");
238+
"""
239+
[
240+
{
241+
"name": "DENOMINATOR.IO."
242+
},
243+
{
244+
"name": "DENOMINATOR.IO.",
245+
"id": "ABCD"
246+
}
247+
]""");
246248
}
247249

248250
/** Enabled via {@link feign.Feign.Builder#dismiss404()} */

moshi/src/test/java/feign/moshi/MoshiDecoderTest.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,17 @@ class Zone extends LinkedHashMap<String, Object> {
6969
}
7070

7171
private String zonesJson =
72-
"" //
73-
+ "[\n" //
74-
+ " {\n" //
75-
+ " \"name\": \"denominator.io.\"\n" //
76-
+ " },\n" //
77-
+ " {\n" //
78-
+ " \"name\": \"denominator.io.\",\n" //
79-
+ " \"id\": \"ABCD\"\n" //
80-
+ " }\n" //
81-
+ "]\n";
72+
"""
73+
[
74+
{
75+
"name": "denominator.io."
76+
},
77+
{
78+
"name": "denominator.io.",
79+
"id": "ABCD"
80+
}
81+
]
82+
""";
8283

8384
private final String videoGamesJson =
8485
"""

moshi/src/test/java/feign/moshi/MoshiEncoderTest.java

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ void encodesMapObjectNumericalValuesAsInteger() {
3939
new MoshiEncoder().encode(map, Map.class, template);
4040

4141
assertThat(template)
42-
.hasBody(
43-
"{\n" //
44-
+ " \"foo\": 1\n" //
45-
+ "}");
42+
.hasBody("""
43+
{
44+
"foo": 1
45+
}\
46+
""");
4647
}
4748

4849
@Test
@@ -58,13 +59,15 @@ void encodesFormParams() {
5859

5960
assertThat(template)
6061
.hasBody(
61-
"{\n" //
62-
+ " \"foo\": 1,\n" //
63-
+ " \"bar\": [\n" //
64-
+ " 2,\n" //
65-
+ " 3\n" //
66-
+ " ]\n" //
67-
+ "}");
62+
"""
63+
{
64+
"foo": 1,
65+
"bar": [
66+
2,
67+
3
68+
]
69+
}\
70+
""");
6871
}
6972

7073
@Test
@@ -82,16 +85,16 @@ void customEncoder() {
8285

8386
assertThat(template)
8487
.hasBody(
85-
"" //
86-
+ "[\n" //
87-
+ " {\n" //
88-
+ " \"name\": \"DENOMINATOR.IO.\"\n" //
89-
+ " },\n" //
90-
+ " {\n" //
91-
+ " \"name\": \"DENOMINATOR.IO.\",\n" //
92-
+ " \"id\": \"ABCD\"\n" //
93-
+ " }\n" //
94-
+ "]");
88+
"""
89+
[
90+
{
91+
"name": "DENOMINATOR.IO."
92+
},
93+
{
94+
"name": "DENOMINATOR.IO.",
95+
"id": "ABCD"
96+
}
97+
]""");
9598
}
9699

97100
@Test

moshi/src/test/java/feign/moshi/Zone.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package feign.moshi;
1717

18+
import java.io.Serial;
1819
import java.util.LinkedHashMap;
1920

2021
public class Zone extends LinkedHashMap<String, Object> {
@@ -34,5 +35,5 @@ public class Zone extends LinkedHashMap<String, Object> {
3435
}
3536
}
3637

37-
private static final long serialVersionUID = 1L;
38+
@Serial private static final long serialVersionUID = 1L;
3839
}

vertx/src/test/java/feign/vertx/AbstractClientReconnectTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static void setupMockServer() {
5050

5151
@Test
5252
@DisplayName("All requests should be answered")
53-
void testAllRequestsShouldBeAnswered(VertxTestContext testContext) {
53+
void allRequestsShouldBeAnswered(VertxTestContext testContext) {
5454
sendRequests(10).compose(responses -> assertAllRequestsAnswered(responses, testContext));
5555
}
5656

@@ -65,7 +65,7 @@ void shutDownServer() {
6565

6666
@Test
6767
@DisplayName("All requests should fail")
68-
void testAllRequestsShouldFail(VertxTestContext testContext) {
68+
void allRequestsShouldFail(VertxTestContext testContext) {
6969
sendRequests(10)
7070
.onComplete(
7171
responses ->
@@ -104,7 +104,7 @@ void shutDownServer() {
104104

105105
@Test
106106
@DisplayName("All requests should be answered")
107-
void testAllRequestsShouldBeAnswered(VertxTestContext testContext) {
107+
void allRequestsShouldBeAnswered(VertxTestContext testContext) {
108108
sendRequests(10).compose(responses -> assertAllRequestsAnswered(responses, testContext));
109109
}
110110
}

0 commit comments

Comments
 (0)