Skip to content

Commit 61a47da

Browse files
authored
[mongodb] Replace apache.commons (openhab#16924)
Signed-off-by: Leo Siepel <[email protected]>
1 parent 994a6b8 commit 61a47da

File tree

1 file changed

+7
-2
lines changed
  • bundles/org.openhab.persistence.mongodb/src/test/java/org/openhab/persistence/mongodb/internal

1 file changed

+7
-2
lines changed

bundles/org.openhab.persistence.mongodb/src/test/java/org/openhab/persistence/mongodb/internal/VerificationHelper.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.util.Map;
2121
import java.util.function.BiFunction;
2222

23-
import org.apache.commons.lang3.tuple.Pair;
2423
import org.bson.Document;
2524
import org.bson.json.JsonWriterSettings;
2625
import org.bson.types.Binary;
@@ -102,7 +101,7 @@ public static void verifyDocumentWithAlias(Document document, String expectedAli
102101
Pair<Object, Object> values = handler.apply(expectedValue, document);
103102

104103
JsonWriterSettings jsonWriterSettings = JsonWriterSettings.builder().indent(true).build();
105-
assertEquals(values.getLeft(), values.getRight(),
104+
assertEquals(values.left, values.right,
106105
"Document: (" + expectedValue.getClass().getSimpleName() + ") " + document.toJson(jsonWriterSettings));
107106

108107
assertNotNull(document.get("_id"));
@@ -203,4 +202,10 @@ private static Pair<Object, Object> handleRawType(Object ev, Document doc) {
203202
Object value = doc.get(MongoDBFields.FIELD_VALUE);
204203
return Pair.of(expectedDoc, value != null ? value : new Object());
205204
}
205+
206+
public record Pair<L, R> (L left, R right) {
207+
public static <L, R> Pair<L, R> of(final L left, final R right) {
208+
return left != null || right != null ? new Pair<>(left, right) : new Pair<>(null, null);
209+
}
210+
}
206211
}

0 commit comments

Comments
 (0)