Skip to content

Commit bccb97a

Browse files
author
David DE CARVALHO
committed
fix OpenAPITools#358 - formatting code with fmt-maven-plugin
1 parent 0b709eb commit bccb97a

File tree

2 files changed

+29
-27
lines changed

2 files changed

+29
-27
lines changed

core/src/main/java/org/openapitools/openapidiff/core/compare/PathsDiff.java

+11-10
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import io.swagger.v3.oas.models.Operation;
44
import io.swagger.v3.oas.models.PathItem;
55
import io.swagger.v3.oas.models.Paths;
6+
import io.swagger.v3.oas.models.parameters.Parameter;
67
import java.util.*;
78
import java.util.regex.Matcher;
89
import java.util.regex.Pattern;
910
import java.util.stream.IntStream;
10-
import io.swagger.v3.oas.models.parameters.Parameter;
1111
import org.openapitools.openapidiff.core.model.Changed;
1212
import org.openapitools.openapidiff.core.model.ChangedPaths;
1313
import org.openapitools.openapidiff.core.model.DiffContext;
@@ -103,12 +103,10 @@ public static Paths valOrEmpty(Paths path) {
103103
}
104104

105105
/**
106-
*
107106
* @param a a path form the open api spec
108107
* @param b another path from the same open api spec
109-
* @return <code>true</code> in case both paths are of the same method AND their templated parameters are of the same type;
110-
* <code>false</code> otherwise
111-
*
108+
* @return <code>true</code> in case both paths are of the same method AND their templated
109+
* parameters are of the same type; <code>false</code> otherwise
112110
*/
113111
private static boolean methodsAndParametersIntersect(PathItem a, PathItem b) {
114112
Set<PathItem.HttpMethod> methodsA = a.readOperationsMap().keySet();
@@ -126,15 +124,18 @@ private static boolean methodsAndParametersIntersect(PathItem a, PathItem b) {
126124
}
127125

128126
/**
129-
*
130127
* @param left parameters from the first compared method
131128
* @param right parameters from the second compared method
132-
* @return <code>true</code> in case each parameter pair is of the same type; <code>false</code> otherwise
129+
* @return <code>true</code> in case each parameter pair is of the same type; <code>false</code>
130+
* otherwise
133131
*/
134-
private static boolean parametersIntersect(List<Parameter> left, List<Parameter> right) {;
132+
private static boolean parametersIntersect(List<Parameter> left, List<Parameter> right) {
133+
;
135134
int parametersSize = left.size();
136-
long intersectedParameters = IntStream.range(0, left.size())
137-
.filter(i -> left.get(i).getSchema().getType().equals(right.get(i).getSchema().getType()))
135+
long intersectedParameters =
136+
IntStream.range(0, left.size())
137+
.filter(
138+
i -> left.get(i).getSchema().getType().equals(right.get(i).getSchema().getType()))
138139
.count();
139140
return parametersSize == intersectedParameters;
140141
}
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
package org.openapitools.openapidiff.core;
22

3-
import org.junit.jupiter.api.Test;
4-
53
import static org.junit.jupiter.api.Assertions.*;
64
import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiAreEquals;
75

6+
import org.junit.jupiter.api.Test;
7+
88
class ParametersOverloadingTest {
99

10-
private final String OVERLOADED_PARAMETERS = "parameters_overloading.yaml";
11-
private final String DUPLICATED_PARAMETER_TYPES = "parameters_overloading_2.yaml";
10+
private final String OVERLOADED_PARAMETERS = "parameters_overloading.yaml";
11+
private final String DUPLICATED_PARAMETER_TYPES = "parameters_overloading_2.yaml";
1212

13-
@Test
14-
void testDiffWithOverloadedParameterTypes() {
15-
assertDoesNotThrow(() -> OpenApiCompare.fromLocations(OVERLOADED_PARAMETERS, OVERLOADED_PARAMETERS));
16-
assertOpenApiAreEquals(OVERLOADED_PARAMETERS, OVERLOADED_PARAMETERS);
17-
}
13+
@Test
14+
void testDiffWithOverloadedParameterTypes() {
15+
assertDoesNotThrow(
16+
() -> OpenApiCompare.fromLocations(OVERLOADED_PARAMETERS, OVERLOADED_PARAMETERS));
17+
assertOpenApiAreEquals(OVERLOADED_PARAMETERS, OVERLOADED_PARAMETERS);
18+
}
1819

19-
@Test
20-
void testDiffWithDuplicatedParameterTypes() {
21-
assertThrows(
22-
IllegalArgumentException.class,
23-
() -> OpenApiCompare.fromLocations(DUPLICATED_PARAMETER_TYPES, DUPLICATED_PARAMETER_TYPES),
24-
"Two path items have the same signature: /projects/{}");
25-
}
26-
}
20+
@Test
21+
void testDiffWithDuplicatedParameterTypes() {
22+
assertThrows(
23+
IllegalArgumentException.class,
24+
() -> OpenApiCompare.fromLocations(DUPLICATED_PARAMETER_TYPES, DUPLICATED_PARAMETER_TYPES),
25+
"Two path items have the same signature: /projects/{}");
26+
}
27+
}

0 commit comments

Comments
 (0)