Skip to content

Commit 98bab8d

Browse files
Heng CuiHeng Cui
authored andcommitted
spotless apply
1 parent f2c3910 commit 98bab8d

3 files changed

Lines changed: 57 additions & 57 deletions

File tree

json-transformation/src/main/java/com/swisscom/daisy/cosmos/candyfloss/transformations/match/MatchNot.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@
1313
@Getter
1414
@AllArgsConstructor
1515
public class MatchNot implements Match {
16-
private final Match innerMatch;
17-
private static final Configuration configuration =
18-
Configuration.builder().options(Option.SUPPRESS_EXCEPTIONS).build();
16+
private final Match innerMatch;
17+
private static final Configuration configuration =
18+
Configuration.builder().options(Option.SUPPRESS_EXCEPTIONS).build();
1919

20-
private final String tag;
20+
private final String tag;
2121

22-
@Override
23-
public boolean match(Object jsonObject) {
24-
DocumentContext context = JsonPath.using(configuration).parse(jsonObject);
25-
return !this.innerMatch.matchContext(context);
26-
}
22+
@Override
23+
public boolean match(Object jsonObject) {
24+
DocumentContext context = JsonPath.using(configuration).parse(jsonObject);
25+
return !this.innerMatch.matchContext(context);
26+
}
2727

28-
@Override
29-
public boolean matchContext(DocumentContext context) {
30-
return !this.innerMatch.matchContext(context);
31-
}
28+
@Override
29+
public boolean matchContext(DocumentContext context) {
30+
return !this.innerMatch.matchContext(context);
31+
}
3232
}

json-transformation/src/test/java/com/swisscom/daisy/cosmos/candyfloss/transformations/match/MatchBuilderTest.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,29 +92,29 @@ public void testMatchOr() throws IOException, InvalidMatchConfiguration {
9292
@Test
9393
public void testMatchNot() throws IOException, InvalidMatchConfiguration {
9494
Map<String, Object> configFalse =
95+
Map.of(
96+
"not",
9597
Map.of(
96-
"not",
98+
"and",
99+
List.of(
97100
Map.of(
98-
"and",
99-
List.of(
100-
Map.of(
101-
"jsonpath",
102-
"$.telemetry_data.encoding_path",
103-
"value",
104-
"openconfig-interfaces:interfaces"))));
101+
"jsonpath",
102+
"$.telemetry_data.encoding_path",
103+
"value",
104+
"openconfig-interfaces:interfaces"))));
105105
Map<String, Object> configTrue =
106+
Map.of(
107+
"not",
106108
Map.of(
107-
"not",
108-
Map.of(
109-
"jsonpath",
110-
"$.telemetry_data.encoding_path1",
111-
"value",
112-
"openconfig-interfaces:interfaces"));
109+
"jsonpath",
110+
"$.telemetry_data.encoding_path1",
111+
"value",
112+
"openconfig-interfaces:interfaces"));
113113
var matchTrue = MatchBuilder.fromJson(configFalse, "t1");
114114
var matchFalse = MatchBuilder.fromJson(configTrue, "t1");
115115
var input =
116-
JsonUtil.readJson(
117-
getClass().getClassLoader().getResource("openconfig-interfaces/input.json"));
116+
JsonUtil.readJson(
117+
getClass().getClassLoader().getResource("openconfig-interfaces/input.json"));
118118
assertFalse(matchTrue.match(input));
119119
assertTrue(matchFalse.match(input));
120120
}

json-transformation/src/test/java/com/swisscom/daisy/cosmos/candyfloss/transformations/match/MatchNotTest.java

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,35 @@
1010
import org.junit.jupiter.api.Test;
1111

1212
class MatchNotTest {
13-
@Test
14-
public void testMatch() throws IOException {
15-
var jsonPath1 = JsonPath.compile("$.telemetry_data.encoding_path");
16-
var jsonPath2 = JsonPath.compile("$.telemetry_data.encoding_path_no_exist");
17-
var matchTrue = new MatchJsonPathExists(jsonPath1, "t1");
18-
var matchFalse = new MatchJsonPathExists(jsonPath2, "t1");
19-
var input =
20-
JsonUtil.readJson(
21-
getClass().getClassLoader().getResource("openconfig-interfaces/input.json"));
13+
@Test
14+
public void testMatch() throws IOException {
15+
var jsonPath1 = JsonPath.compile("$.telemetry_data.encoding_path");
16+
var jsonPath2 = JsonPath.compile("$.telemetry_data.encoding_path_no_exist");
17+
var matchTrue = new MatchJsonPathExists(jsonPath1, "t1");
18+
var matchFalse = new MatchJsonPathExists(jsonPath2, "t1");
19+
var input =
20+
JsonUtil.readJson(
21+
getClass().getClassLoader().getResource("openconfig-interfaces/input.json"));
2222

23-
var matchNotFalse = new MatchNot(matchTrue, "t1");
24-
var matchNotTrue = new MatchNot(matchFalse, "t1");
23+
var matchNotFalse = new MatchNot(matchTrue, "t1");
24+
var matchNotTrue = new MatchNot(matchFalse, "t1");
2525

26-
assertTrue(matchTrue.match(input));
27-
assertFalse(matchFalse.match(input));
28-
assertFalse(matchNotFalse.match(input));
29-
assertTrue(matchNotTrue.match(input));
30-
}
26+
assertTrue(matchTrue.match(input));
27+
assertFalse(matchFalse.match(input));
28+
assertFalse(matchNotFalse.match(input));
29+
assertTrue(matchNotTrue.match(input));
30+
}
3131

32-
@Test
33-
public void testMatchComplex() throws IOException {
34-
var matchTrue = new MatchOr(List.of(new MatchTrue("t1"), new MatchFalse("t1")), "t1");
35-
var matchFalse = new MatchOr(List.of(new MatchFalse("t1"), new MatchFalse("t1")), "t1");
36-
var matchNotFalse = new MatchNot(matchTrue, "t1");
37-
var matchNotTrue = new MatchNot(matchFalse, "t1");
38-
var input =
39-
JsonUtil.readJson(
40-
getClass().getClassLoader().getResource("openconfig-interfaces/input.json"));
41-
assertTrue(matchNotTrue.match(input));
42-
assertFalse(matchNotFalse.match(input));
43-
}
32+
@Test
33+
public void testMatchComplex() throws IOException {
34+
var matchTrue = new MatchOr(List.of(new MatchTrue("t1"), new MatchFalse("t1")), "t1");
35+
var matchFalse = new MatchOr(List.of(new MatchFalse("t1"), new MatchFalse("t1")), "t1");
36+
var matchNotFalse = new MatchNot(matchTrue, "t1");
37+
var matchNotTrue = new MatchNot(matchFalse, "t1");
38+
var input =
39+
JsonUtil.readJson(
40+
getClass().getClassLoader().getResource("openconfig-interfaces/input.json"));
41+
assertTrue(matchNotTrue.match(input));
42+
assertFalse(matchNotFalse.match(input));
43+
}
4444
}

0 commit comments

Comments
 (0)