// Path: cloud-spanner-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/v2/JsonWrapper.java
// public class JsonWrapper {
//   private String jsonString;
// 
//   public JsonWrapper(String jsonString) {
//     this.jsonString = jsonString;
//   }
// 
//   protected Value getJsonVal() {
//     return Value.json(this.jsonString);
//   }
// 
//   public static JsonWrapper of(String jsonString) {
//     return new JsonWrapper(jsonString);
//   }
// 
//   @Override
//   public String toString() {
//     return this.jsonString;
//   }
// 
//   @Override
//   public boolean equals(Object o) {
//     if (this == o) {
//       return true;
//     }
//     if (o == null || getClass() != o.getClass()) {
//       return false;
//     }
//     JsonWrapper that = (JsonWrapper) o;
//     return Objects.equal(this.jsonString, that.jsonString);
//   }
// 
//   @Override
//   public int hashCode() {
//     return Objects.hashCode(this.jsonString);
//   }
// }


import org.springframework.data.relational.core.sql.Table;
import org.springframework.r2dbc.core.binding.BindMarkers;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.cloud.spanner.r2dbc.v2.JsonWrapper;
import java.util.Collection;
import org.junit.jupiter.api.Test;
import org.springframework.data.mapping.model.SimpleTypeHolder;
import org.springframework.data.relational.core.dialect.LimitClause;
import org.springframework.data.relational.core.dialect.LockClause;
import org.springframework.data.relational.core.sql.LockMode;
import org.springframework.data.relational.core.sql.LockOptions;
import org.springframework.data.relational.core.sql.SQL;
import org.springframework.data.relational.core.sql.Select;

  @Test
  void testBindMarkersFactory() {
    SpannerR2dbcDialect dialect = new SpannerR2dbcDialect();
    BindMarkers bindMarkers = dialect.getBindMarkersFactory().create();
    assertThat(bindMarkers).isNotNull();
    assertThat(bindMarkers.next().getPlaceholder()).isEqualTo("@val0");
    assertThat(bindMarkers.next().getPlaceholder()).isEqualTo("@val1");
  }

  @Test
  void lockStringAlwaysEmpty() {
    SpannerR2dbcDialect dialect = new SpannerR2dbcDialect();
    Table table = SQL.table("aTable");
    Select sql = Select.builder().select(table.column("aColumn"))
        .from(table)
        .build();
    LockOptions lockOptions = new LockOptions(LockMode.PESSIMISTIC_READ, sql.getFrom());

    LockClause lock = dialect.lock();

    assertNotNull(lock);
    assertThat(lock.getLock(lockOptions)).isEmpty();
    assertThat(lock.getClausePosition()).isSameAs(LockClause.Position.AFTER_FROM_TABLE);
  }

  @Test
  void testSimpleType() {
    SpannerR2dbcDialect dialect = new SpannerR2dbcDialect();
    SimpleTypeHolder simpleTypeHolder = dialect.getSimpleTypeHolder();
// Path: cloud-spanner-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/v2/JsonWrapper.java
// public class JsonWrapper {
//   private String jsonString;
// 
//   public JsonWrapper(String jsonString) {
//     this.jsonString = jsonString;
//   }
// 
//   protected Value getJsonVal() {
//     return Value.json(this.jsonString);
//   }
// 
//   public static JsonWrapper of(String jsonString) {
//     return new JsonWrapper(jsonString);
//   }
// 
//   @Override
//   public String toString() {
//     return this.jsonString;
//   }
// 
//   @Override
//   public boolean equals(Object o) {
//     if (this == o) {
//       return true;
//     }
//     if (o == null || getClass() != o.getClass()) {
//       return false;
//     }
//     JsonWrapper that = (JsonWrapper) o;
//     return Objects.equal(this.jsonString, that.jsonString);
//   }
// 
//   @Override
//   public int hashCode() {
//     return Objects.hashCode(this.jsonString);
//   }
// }


// Path: cloud-spanner-spring-data-r2dbc/src/test/java/com/google/cloud/spanner/r2dbc/springdata/SpannerR2dbcDialectTest.java
import org.springframework.data.relational.core.sql.Table;
import org.springframework.r2dbc.core.binding.BindMarkers;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.cloud.spanner.r2dbc.v2.JsonWrapper;
import java.util.Collection;
import org.junit.jupiter.api.Test;
import org.springframework.data.mapping.model.SimpleTypeHolder;
import org.springframework.data.relational.core.dialect.LimitClause;
import org.springframework.data.relational.core.dialect.LockClause;
import org.springframework.data.relational.core.sql.LockMode;
import org.springframework.data.relational.core.sql.LockOptions;
import org.springframework.data.relational.core.sql.SQL;
import org.springframework.data.relational.core.sql.Select;


  @Test
  void testBindMarkersFactory() {
    SpannerR2dbcDialect dialect = new SpannerR2dbcDialect();
    BindMarkers bindMarkers = dialect.getBindMarkersFactory().create();
    assertThat(bindMarkers).isNotNull();
    assertThat(bindMarkers.next().getPlaceholder()).isEqualTo("@val0");
    assertThat(bindMarkers.next().getPlaceholder()).isEqualTo("@val1");
  }

  @Test
  void lockStringAlwaysEmpty() {
    SpannerR2dbcDialect dialect = new SpannerR2dbcDialect();
    Table table = SQL.table("aTable");
    Select sql = Select.builder().select(table.column("aColumn"))
        .from(table)
        .build();
    LockOptions lockOptions = new LockOptions(LockMode.PESSIMISTIC_READ, sql.getFrom());

    LockClause lock = dialect.lock();

    assertNotNull(lock);
    assertThat(lock.getLock(lockOptions)).isEmpty();
    assertThat(lock.getClausePosition()).isSameAs(LockClause.Position.AFTER_FROM_TABLE);
  }

  @Test
  void testSimpleType() {
    SpannerR2dbcDialect dialect = new SpannerR2dbcDialect();
    SimpleTypeHolder simpleTypeHolder = dialect.getSimpleTypeHolder();
    assertThat(simpleTypeHolder.isSimpleType(JsonWrapper.class)).isTrue();