[mongodb] Replace apache.commons (#16924)

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
lsiepel 2024-06-23 22:40:51 +02:00 committed by Ciprian Pascu
parent 0d6250db1c
commit 3555e45df2

View 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);
}
}
}