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> <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>

View File

@ -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

View File

@ -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());