Skip to content

Commit

Permalink
fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles A. Daniels committed May 9, 2024
1 parent 8522913 commit f2b01fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/main/java/com/styra/opa/OPAClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@ public <T> T evaluate() throws OPAException {
return evaluateMachinery(Input.of(defaultInput()), Optional.empty());
}


private ExecutePolicyWithInputRequest makeRequestForEvaluate(Input input, Optional<String> path) {
String concretePath = "system/main";
if (path.isPresent()) {
Expand Down Expand Up @@ -554,7 +553,7 @@ private <T> T evaluateMachinery(Input input, Optional<String> path) throws OPAEx
ObjectMapper mapper = new ObjectMapper();
T typedResult = mapper.convertValue(out, new TypeReference<T>() {});
return typedResult;
} {
} else {
// No result, so we just return null
return null;
}
Expand Down Expand Up @@ -617,7 +616,12 @@ private <T> T evaluateMachinery(Input input, Optional<String> path, JavaType toV
}
}

private <T> T evaluateMachinery(Input input, Optional<String> path, TypeReference<T> toValueType) throws OPAException {
private <T> T evaluateMachinery(
Input input,
Optional<String> path,
TypeReference<T> toValueType
) throws OPAException {

ExecutePolicyWithInputRequest req = makeRequestForEvaluate(input, path);
ExecutePolicyWithInputResponse res;

Expand Down
3 changes: 1 addition & 2 deletions src/test/java/com/styra/opa/OPATest.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public void testObjectRoundtripWithTypeChange() {
@Test
public void testOPADefaultPathWithInput() {
OPAClient opa = new OPAClient(address, headers);
Map<String,java.lang.Object> input = Map.ofEntries(entry("hello", "world"));
Map<String, java.lang.Object> input = Map.ofEntries(entry("hello", "world"));
Map result = Map.ofEntries(entry("unit", "test"));
Map expect = Map.ofEntries(
entry("msg", "this is the default path"),
Expand Down Expand Up @@ -298,6 +298,5 @@ public void testOPADefaultPathWithoutInput() {
assertEquals(expect, result);
}


}

0 comments on commit f2b01fb

Please sign in to comment.