style: include OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION (#5274)

This commit is contained in:
Piotr Idzik 2024-07-03 18:55:09 +02:00 committed by GitHub
parent 5bc96cf789
commit 26b4b82949
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 7 deletions

View File

@ -123,9 +123,6 @@
<Match>
<Bug pattern="BL_BURYING_LOGIC" />
</Match>
<Match>
<Bug pattern="OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION" />
</Match>
<Match>
<Bug pattern="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" />
</Match>

View File

@ -53,7 +53,7 @@ public class BreadthFirstSearchTest {
// check value
Optional<Node<String>> value = bfs.search(root, expectedValue);
assertEquals(expectedValue, value.orElse(new Node<>("")).getValue());
assertEquals(expectedValue, value.orElseGet(() -> new Node<>("")).getValue());
// check path
assertArrayEquals(expectedPath.toArray(), bfs.getVisited().toArray());
@ -65,7 +65,7 @@ public class BreadthFirstSearchTest {
List<String> expectedPath = List.of("A", "B", "C", "D", "E", "F");
// 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());
// check path

View File

@ -54,7 +54,7 @@ public class DepthFirstSearchTest {
// check value
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
assertArrayEquals(expectedPath.toArray(), dfs.getVisited().toArray());
@ -67,7 +67,7 @@ public class DepthFirstSearchTest {
// check value
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
assertArrayEquals(expectedPath.toArray(), dfs.getVisited().toArray());