content: package com.alibaba.innodb.java.reader.column;
  
  import com.google.common.collect.ImmutableList;
  
  import com.alibaba.innodb.java.reader.AbstractTest;
  import com.alibaba.innodb.java.reader.page.index.GenericRecord;
  import com.alibaba.innodb.java.reader.schema.Column;
  import com.alibaba.innodb.java.reader.schema.TableDef;
  
  import org.junit.Test;
  
  import java.util.Arrays;
  import java.util.List;
  import java.util.function.Consumer;
  
  import static org.hamcrest.core.Is.is;
  import static org.junit.Assert.assertThat;
  
  /**
   * @author xu.zx
   */
  public class ColumnBooleanTableReaderTest extends AbstractTest {
  
    public TableDef getTableDef() {
      return new TableDef()
          .addColumn(new Column().setName("id").setType("int(11)").setNullable(false).setPrimaryKey(true))
          .addColumn(new Column().setName("a").setType("boolean").setNullable(false))
          .addColumn(new Column().setName("b").setType("BOOL").setNullable(false));
    }
  
    @Test
    public void testBooleanColumnMysql56() {
      assertTestOf(this)
          .withMysql56()
          .withTableDef(getTableDef())
          .checkAllRecordsIs(expected());
    }
  
    @Test
    public void testBooleanColumnMysql57() {
      assertTestOf(this)
          .withMysql57()
          .withTableDef(getTableDef())
          .checkAllRecordsIs(expected());
    }
  
    @Test
    public void testBooleanColumnMysql80() {
      assertTestOf(this)
          .withMysql80()
          .withTableDef(getTableDef())
          .checkAllRecordsIs(expected());
    }
  
    public Consumer<List<GenericRecord>> expected() {
      return recordList -> {
        assertThat(recordList.size(), is(2));
  
        GenericRecord r1 = recordList.get(0);
        Object[] v1 = r1.getValues();
        System.out.println(Arrays.asList(v1));
        assertThat(r1.getPrimaryKey(), is(ImmutableList.of(1)));
        assertThat(r1.get("a"), is(true));
        assertThat(r1.get("b"), is(false));
  
        GenericRecord r2 = recordList.get(1);
        Object[] v2 = r2.getValues();
        System.out.println(Arrays.asList(v2));
        assertThat(r2.getPrimaryKey(), is(ImmutableList.of(2)));
        assertThat(r2.get("a"), is(false));
        assertThat(r2.get("b"), is(true));
      };
    }
  }
  