]> git.basschouten.com Git - openhab-addons.git/commitdiff
[mongodb] Replace apache.commons (#16924)
authorlsiepel <leosiepel@gmail.com>
Sun, 23 Jun 2024 20:40:51 +0000 (22:40 +0200)
committerGitHub <noreply@github.com>
Sun, 23 Jun 2024 20:40:51 +0000 (22:40 +0200)
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
bundles/org.openhab.persistence.mongodb/src/test/java/org/openhab/persistence/mongodb/internal/VerificationHelper.java

index 09e4ea6f1162b12ade0377257a309518e94210ea..1e6093f4fe661d84994aaa1a46d894fe25368904 100644 (file)
@@ -20,7 +20,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.function.BiFunction;
 
-import org.apache.commons.lang3.tuple.Pair;
 import org.bson.Document;
 import org.bson.json.JsonWriterSettings;
 import org.bson.types.Binary;
@@ -102,7 +101,7 @@ public class VerificationHelper {
         Pair<Object, Object> values = handler.apply(expectedValue, document);
 
         JsonWriterSettings jsonWriterSettings = JsonWriterSettings.builder().indent(true).build();
-        assertEquals(values.getLeft(), values.getRight(),
+        assertEquals(values.left, values.right,
                 "Document: (" + expectedValue.getClass().getSimpleName() + ") " + document.toJson(jsonWriterSettings));
 
         assertNotNull(document.get("_id"));
@@ -203,4 +202,10 @@ public class VerificationHelper {
         Object value = doc.get(MongoDBFields.FIELD_VALUE);
         return Pair.of(expectedDoc, value != null ? value : new Object());
     }
+
+    public record Pair<L, R> (L left, R right) {
+        public static <L, R> Pair<L, R> of(final L left, final R right) {
+            return left != null || right != null ? new Pair<>(left, right) : new Pair<>(null, null);
+        }
+    }
 }