Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions core/src/test/java/feign/stream/StreamDecoderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,18 @@ class Car {
}

private String carsJson =
"" //
+ "[\n" //
+ " {\n" //
+ " \"name\": \"Megane\",\n" //
+ " \"manufacturer\": \"Renault\"\n" //
+ " },\n" //
+ " {\n" //
+ " \"name\": \"C4\",\n" //
+ " \"manufacturer\": \"Citroën\"\n" //
+ " }\n" //
+ "]\n";
"""
[
{
"name": "Megane",
"manufacturer": "Renault"
},
{
"name": "C4",
"manufacturer": "Citroën"
}
]
""";

@Test
void simpleStreamTest() {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import static lombok.AccessLevel.PRIVATE;

import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
Expand All @@ -30,7 +31,7 @@
@FieldDefaults(level = PRIVATE)
public class Dto implements Serializable {

private static final long serialVersionUID = -4218390863359894943L;
@Serial private static final long serialVersionUID = -4218390863359894943L;

String field1;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import feign.jackson.JacksonEncoder;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Map;
import lombok.val;
Expand Down Expand Up @@ -61,7 +61,7 @@ void testFormException() {
@Test
void testUpload() throws Exception {
val path =
Paths.get(Thread.currentThread().getContextClassLoader().getResource("file.txt").toURI());
Path.of(Thread.currentThread().getContextClassLoader().getResource("file.txt").toURI());
assertThat(path).exists();

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

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

val path2 =
Paths.get(
Path.of(
Thread.currentThread().getContextClassLoader().getResource("another_file.txt").toURI());
assertThat(path2).exists();

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

val path2 =
Paths.get(
Path.of(
Thread.currentThread().getContextClassLoader().getResource("another_file.txt").toURI());
assertThat(path2).exists();

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

val path =
Paths.get(Thread.currentThread().getContextClassLoader().getResource("file.txt").toURI());
Path.of(Thread.currentThread().getContextClassLoader().getResource("file.txt").toURI());
assertThat(path).exists();

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

assertThat(API.uploadUnknownType(path.toFile())).isEqualTo("application/octet-stream");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import static lombok.AccessLevel.PRIVATE;

import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
Expand All @@ -29,7 +30,7 @@
@FieldDefaults(level = PRIVATE)
class Dto implements Serializable {

private static final long serialVersionUID = 4743133513526293872L;
@Serial private static final long serialVersionUID = 4743133513526293872L;

String name;

Expand Down
68 changes: 35 additions & 33 deletions gson/src/test/java/feign/gson/GsonCodecTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ void encodesMapObjectNumericalValuesAsInteger() {
new GsonEncoder().encode(map, map.getClass(), template);

assertThat(template)
.hasBody(
"" //
+ "{\n" //
+ " \"foo\": 1\n" //
+ "}");
.hasBody("""
{
"foo": 1
}\
""");
}

@Test
Expand Down Expand Up @@ -87,14 +87,15 @@ void encodesFormParams() {

assertThat(template)
.hasBody(
"" //
+ "{\n" //
+ " \"foo\": 1,\n" //
+ " \"bar\": [\n" //
+ " 2,\n" //
+ " 3\n" //
+ " ]\n" //
+ "}");
"""
{
"foo": 1,
"bar": [
2,
3
]
}\
""");
}

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

private String zonesJson =
"" //
+ "[\n" //
+ " {\n" //
+ " \"name\": \"denominator.io.\"\n" //
+ " },\n" //
+ " {\n" //
+ " \"name\": \"denominator.io.\",\n" //
+ " \"id\": \"ABCD\"\n" //
+ " }\n" //
+ "]\n";
"""
[
{
"name": "denominator.io."
},
{
"name": "denominator.io.",
"id": "ABCD"
}
]
""";

final TypeAdapter upperZone =
new TypeAdapter<Zone>() {
Expand Down Expand Up @@ -233,16 +235,16 @@ void customEncoder() {

assertThat(template)
.hasBody(
"" //
+ "[\n" //
+ " {\n" //
+ " \"name\": \"DENOMINATOR.IO.\"\n" //
+ " },\n" //
+ " {\n" //
+ " \"name\": \"DENOMINATOR.IO.\",\n" //
+ " \"id\": \"ABCD\"\n" //
+ " }\n" //
+ "]");
"""
[
{
"name": "DENOMINATOR.IO."
},
{
"name": "DENOMINATOR.IO.",
"id": "ABCD"
}
]""");
}

/** Enabled via {@link feign.Feign.Builder#dismiss404()} */
Expand Down
21 changes: 11 additions & 10 deletions moshi/src/test/java/feign/moshi/MoshiDecoderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,17 @@ class Zone extends LinkedHashMap<String, Object> {
}

private String zonesJson =
"" //
+ "[\n" //
+ " {\n" //
+ " \"name\": \"denominator.io.\"\n" //
+ " },\n" //
+ " {\n" //
+ " \"name\": \"denominator.io.\",\n" //
+ " \"id\": \"ABCD\"\n" //
+ " }\n" //
+ "]\n";
"""
[
{
"name": "denominator.io."
},
{
"name": "denominator.io.",
"id": "ABCD"
}
]
""";

private final String videoGamesJson =
"""
Expand Down
45 changes: 24 additions & 21 deletions moshi/src/test/java/feign/moshi/MoshiEncoderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ void encodesMapObjectNumericalValuesAsInteger() {
new MoshiEncoder().encode(map, Map.class, template);

assertThat(template)
.hasBody(
"{\n" //
+ " \"foo\": 1\n" //
+ "}");
.hasBody("""
{
"foo": 1
}\
""");
}

@Test
Expand All @@ -58,13 +59,15 @@ void encodesFormParams() {

assertThat(template)
.hasBody(
"{\n" //
+ " \"foo\": 1,\n" //
+ " \"bar\": [\n" //
+ " 2,\n" //
+ " 3\n" //
+ " ]\n" //
+ "}");
"""
{
"foo": 1,
"bar": [
2,
3
]
}\
""");
}

@Test
Expand All @@ -82,16 +85,16 @@ void customEncoder() {

assertThat(template)
.hasBody(
"" //
+ "[\n" //
+ " {\n" //
+ " \"name\": \"DENOMINATOR.IO.\"\n" //
+ " },\n" //
+ " {\n" //
+ " \"name\": \"DENOMINATOR.IO.\",\n" //
+ " \"id\": \"ABCD\"\n" //
+ " }\n" //
+ "]");
"""
[
{
"name": "DENOMINATOR.IO."
},
{
"name": "DENOMINATOR.IO.",
"id": "ABCD"
}
]""");
}

@Test
Expand Down
3 changes: 2 additions & 1 deletion moshi/src/test/java/feign/moshi/Zone.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package feign.moshi;

import java.io.Serial;
import java.util.LinkedHashMap;

public class Zone extends LinkedHashMap<String, Object> {
Expand All @@ -34,5 +35,5 @@ public class Zone extends LinkedHashMap<String, Object> {
}
}

private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;
}
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@
<module>benchmark</module>
<module>moshi</module>
<module>fastjson2</module>
<module>feign-form</module>
<module>feign-form-spring</module>
<module>form</module>
<module>form-spring</module>
<module>vertx</module>
</modules>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static void setupMockServer() {

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

Expand All @@ -65,7 +65,7 @@ void shutDownServer() {

@Test
@DisplayName("All requests should fail")
void testAllRequestsShouldFail(VertxTestContext testContext) {
void allRequestsShouldFail(VertxTestContext testContext) {
sendRequests(10)
.onComplete(
responses ->
Expand Down Expand Up @@ -104,7 +104,7 @@ void shutDownServer() {

@Test
@DisplayName("All requests should be answered")
void testAllRequestsShouldBeAnswered(VertxTestContext testContext) {
void allRequestsShouldBeAnswered(VertxTestContext testContext) {
sendRequests(10).compose(responses -> assertAllRequestsAnswered(responses, testContext));
}
}
Expand Down
Loading
Loading