style: include OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION
(#5274)
This commit is contained in:
parent
5bc96cf789
commit
26b4b82949
@ -123,9 +123,6 @@
|
|||||||
<Match>
|
<Match>
|
||||||
<Bug pattern="BL_BURYING_LOGIC" />
|
<Bug pattern="BL_BURYING_LOGIC" />
|
||||||
</Match>
|
</Match>
|
||||||
<Match>
|
|
||||||
<Bug pattern="OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION" />
|
|
||||||
</Match>
|
|
||||||
<Match>
|
<Match>
|
||||||
<Bug pattern="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" />
|
<Bug pattern="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" />
|
||||||
</Match>
|
</Match>
|
||||||
|
@ -53,7 +53,7 @@ public class BreadthFirstSearchTest {
|
|||||||
|
|
||||||
// check value
|
// check value
|
||||||
Optional<Node<String>> value = bfs.search(root, expectedValue);
|
Optional<Node<String>> value = bfs.search(root, expectedValue);
|
||||||
assertEquals(expectedValue, value.orElse(new Node<>("")).getValue());
|
assertEquals(expectedValue, value.orElseGet(() -> new Node<>("")).getValue());
|
||||||
|
|
||||||
// check path
|
// check path
|
||||||
assertArrayEquals(expectedPath.toArray(), bfs.getVisited().toArray());
|
assertArrayEquals(expectedPath.toArray(), bfs.getVisited().toArray());
|
||||||
@ -65,7 +65,7 @@ public class BreadthFirstSearchTest {
|
|||||||
List<String> expectedPath = List.of("A", "B", "C", "D", "E", "F");
|
List<String> expectedPath = List.of("A", "B", "C", "D", "E", "F");
|
||||||
|
|
||||||
// check value
|
// check value
|
||||||
Optional<Node<String>> value = Optional.of(bfs.search(root, expectedValue).orElse(new Node<>(null)));
|
Optional<Node<String>> value = Optional.of(bfs.search(root, expectedValue).orElseGet(() -> new Node<>(null)));
|
||||||
assertEquals(expectedValue, value.get().getValue());
|
assertEquals(expectedValue, value.get().getValue());
|
||||||
|
|
||||||
// check path
|
// check path
|
||||||
|
@ -54,7 +54,7 @@ public class DepthFirstSearchTest {
|
|||||||
|
|
||||||
// check value
|
// check value
|
||||||
Optional<Node<Integer>> value = dfs.recursiveSearch(root, expectedValue);
|
Optional<Node<Integer>> value = dfs.recursiveSearch(root, expectedValue);
|
||||||
assertEquals(expectedValue, value.orElse(new Node<>(null)).getValue());
|
assertEquals(expectedValue, value.orElseGet(() -> new Node<>(null)).getValue());
|
||||||
|
|
||||||
// check path
|
// check path
|
||||||
assertArrayEquals(expectedPath.toArray(), dfs.getVisited().toArray());
|
assertArrayEquals(expectedPath.toArray(), dfs.getVisited().toArray());
|
||||||
@ -67,7 +67,7 @@ public class DepthFirstSearchTest {
|
|||||||
|
|
||||||
// check value
|
// check value
|
||||||
Optional<Node<Integer>> value = dfs.recursiveSearch(root, expectedValue);
|
Optional<Node<Integer>> value = dfs.recursiveSearch(root, expectedValue);
|
||||||
assertEquals(expectedValue, value.orElse(new Node<>(null)).getValue());
|
assertEquals(expectedValue, value.orElseGet(() -> new Node<>(null)).getValue());
|
||||||
|
|
||||||
// check path
|
// check path
|
||||||
assertArrayEquals(expectedPath.toArray(), dfs.getVisited().toArray());
|
assertArrayEquals(expectedPath.toArray(), dfs.getVisited().toArray());
|
||||||
|
Loading…
Reference in New Issue
Block a user