diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml
index 8648b910..9aa2e50f 100644
--- a/spotbugs-exclude.xml
+++ b/spotbugs-exclude.xml
@@ -123,9 +123,6 @@
-
-
-
diff --git a/src/test/java/com/thealgorithms/searches/BreadthFirstSearchTest.java b/src/test/java/com/thealgorithms/searches/BreadthFirstSearchTest.java
index 2a32a4dd..d05856dd 100644
--- a/src/test/java/com/thealgorithms/searches/BreadthFirstSearchTest.java
+++ b/src/test/java/com/thealgorithms/searches/BreadthFirstSearchTest.java
@@ -53,7 +53,7 @@ public class BreadthFirstSearchTest {
// check value
Optional> 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 expectedPath = List.of("A", "B", "C", "D", "E", "F");
// check value
- Optional> value = Optional.of(bfs.search(root, expectedValue).orElse(new Node<>(null)));
+ Optional> value = Optional.of(bfs.search(root, expectedValue).orElseGet(() -> new Node<>(null)));
assertEquals(expectedValue, value.get().getValue());
// check path
diff --git a/src/test/java/com/thealgorithms/searches/DepthFirstSearchTest.java b/src/test/java/com/thealgorithms/searches/DepthFirstSearchTest.java
index af21b570..2785d48b 100644
--- a/src/test/java/com/thealgorithms/searches/DepthFirstSearchTest.java
+++ b/src/test/java/com/thealgorithms/searches/DepthFirstSearchTest.java
@@ -54,7 +54,7 @@ public class DepthFirstSearchTest {
// check value
Optional> 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> 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());