// Path: src/main/java/at/grahsl/kafka/connect/mongodb/converter/SinkDocument.java
// public class SinkDocument {
// 
//     private final Optional<BsonDocument> keyDoc;
//     private final Optional<BsonDocument> valueDoc;
// 
//     public SinkDocument(BsonDocument keyDoc, BsonDocument valueDoc) {
//         this.keyDoc = Optional.ofNullable(keyDoc);
//         this.valueDoc = Optional.ofNullable(valueDoc);
//     }
// 
//     public Optional<BsonDocument> getKeyDoc() {
//         return keyDoc;
//     }
// 
//     public Optional<BsonDocument> getValueDoc() {
//         return valueDoc;
//     }
// 
//     public SinkDocument clone() {
//         BsonDocument kd = keyDoc.isPresent() ? keyDoc.get().clone() : null;
//         BsonDocument vd = valueDoc.isPresent() ? valueDoc.get().clone() : null;
//         return new SinkDocument(kd,vd);
//     }
// 
// }


import at.grahsl.kafka.connect.mongodb.converter.SinkDocument;
import com.mongodb.DBCollection;
import com.mongodb.client.model.DeleteOneModel;
import com.mongodb.client.model.WriteModel;
import org.apache.kafka.connect.errors.DataException;
import org.bson.BsonBoolean;
import org.bson.BsonDocument;
import org.bson.BsonInt32;
import org.bson.BsonString;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;
import static org.junit.jupiter.api.Assertions.*;
        DeleteOneModel<BsonDocument> writeModel =
                (DeleteOneModel<BsonDocument>) result;

        assertTrue(writeModel.getFilter() instanceof BsonDocument,
                () -> "filter expected to be of type BsonDocument");

        assertEquals(filterDoc,writeModel.getFilter());

    }

    @Test
    @DisplayName("when missing key doc then DataException")
    public void testMissingKeyDocument() {
        assertThrows(DataException.class,() ->
                RDBMS_DELETE.perform(new SinkDocument(null,new BsonDocument()))
        );
    }

    @Test
    @DisplayName("when missing value doc then DataException")
    public void testMissingValueDocument() {
        assertThrows(DataException.class,() ->
                RDBMS_DELETE.perform(new SinkDocument(new BsonDocument(),null))
        );
    }

    @Test
    @DisplayName("when key doc and value 'before' field both empty then DataException")
    public void testEmptyKeyDocAndEmptyValueBeforeField() {
        assertThrows(DataException.class,() ->
// Path: src/main/java/at/grahsl/kafka/connect/mongodb/converter/SinkDocument.java
// public class SinkDocument {
// 
//     private final Optional<BsonDocument> keyDoc;
//     private final Optional<BsonDocument> valueDoc;
// 
//     public SinkDocument(BsonDocument keyDoc, BsonDocument valueDoc) {
//         this.keyDoc = Optional.ofNullable(keyDoc);
//         this.valueDoc = Optional.ofNullable(valueDoc);
//     }
// 
//     public Optional<BsonDocument> getKeyDoc() {
//         return keyDoc;
//     }
// 
//     public Optional<BsonDocument> getValueDoc() {
//         return valueDoc;
//     }
// 
//     public SinkDocument clone() {
//         BsonDocument kd = keyDoc.isPresent() ? keyDoc.get().clone() : null;
//         BsonDocument vd = valueDoc.isPresent() ? valueDoc.get().clone() : null;
//         return new SinkDocument(kd,vd);
//     }
// 
// }


// Path: src/test/java/at/grahsl/kafka/connect/mongodb/cdc/debezium/rdbms/RdbmsDeleteTest.java
import at.grahsl.kafka.connect.mongodb.converter.SinkDocument;
import com.mongodb.DBCollection;
import com.mongodb.client.model.DeleteOneModel;
import com.mongodb.client.model.WriteModel;
import org.apache.kafka.connect.errors.DataException;
import org.bson.BsonBoolean;
import org.bson.BsonDocument;
import org.bson.BsonInt32;
import org.bson.BsonString;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;
import static org.junit.jupiter.api.Assertions.*;

        DeleteOneModel<BsonDocument> writeModel =
                (DeleteOneModel<BsonDocument>) result;

        assertTrue(writeModel.getFilter() instanceof BsonDocument,
                () -> "filter expected to be of type BsonDocument");

        assertEquals(filterDoc,writeModel.getFilter());

    }

    @Test
    @DisplayName("when missing key doc then DataException")
    public void testMissingKeyDocument() {
        assertThrows(DataException.class,() ->
                RDBMS_DELETE.perform(new SinkDocument(null,new BsonDocument()))
        );
    }

    @Test
    @DisplayName("when missing value doc then DataException")
    public void testMissingValueDocument() {
        assertThrows(DataException.class,() ->
                RDBMS_DELETE.perform(new SinkDocument(new BsonDocument(),null))
        );
    }

    @Test
    @DisplayName("when key doc and value 'before' field both empty then DataException")
    public void testEmptyKeyDocAndEmptyValueBeforeField() {
        assertThrows(DataException.class,() ->
                RDBMS_DELETE.perform(new SinkDocument(new BsonDocument(),