From 61a47da2de2784ddc46c38be45538eb7a6beb23d Mon Sep 17 00:00:00 2001 From: lsiepel Date: Sun, 23 Jun 2024 22:40:51 +0200 Subject: [PATCH] [mongodb] Replace apache.commons (#16924) Signed-off-by: Leo Siepel --- .../persistence/mongodb/internal/VerificationHelper.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.persistence.mongodb/src/test/java/org/openhab/persistence/mongodb/internal/VerificationHelper.java b/bundles/org.openhab.persistence.mongodb/src/test/java/org/openhab/persistence/mongodb/internal/VerificationHelper.java index 09e4ea6f116..1e6093f4fe6 100644 --- a/bundles/org.openhab.persistence.mongodb/src/test/java/org/openhab/persistence/mongodb/internal/VerificationHelper.java +++ b/bundles/org.openhab.persistence.mongodb/src/test/java/org/openhab/persistence/mongodb/internal/VerificationHelper.java @@ -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 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 left, R right) { + public static Pair of(final L left, final R right) { + return left != null || right != null ? new Pair<>(left, right) : new Pair<>(null, null); + } + } }