本文整理了Java中org.fest.assertions.ListAssert.containsExactly()
方法的一些代码示例,展示了ListAssert.containsExactly()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListAssert.containsExactly()
方法的具体详情如下:
包路径:org.fest.assertions.ListAssert
类名称:ListAssert
方法名:containsExactly
暂无
代码示例来源:origin: debezium/debezium
@Test
public void shouldHaveColumns() {
assertThat(table.retrieveColumnNames()).containsExactly("C1", "C2", "C3", "C4");
assertThat(table.columns()).containsExactly(c1, c2, c3, c4);
}
代码示例来源:origin: debezium/debezium
@Test
public void shouldHavePrimaryKeyColumns() {
assertThat(table.primaryKeyColumnNames()).containsExactly("C1", "C2");
assertThat(table.primaryKeyColumns()).containsExactly(c1, c2);
}
代码示例来源:origin: debezium/debezium
@Test
public void shouldHaveColumnsThatAreNotPartOfThePrimaryKey() {
assertThat(table.nonPrimaryKeyColumns()).containsExactly(c3, c4);
}
代码示例来源:origin: debezium/debezium
@Test
public void shouldFilterColumnsUsingPredicate() {
assertThat(table.filterColumns(c->c.isAutoIncremented())).containsExactly(c4);
assertThat(table.filterColumns(c->c.isGenerated())).containsExactly(c1);
assertThat(table.filterColumns(c->c.isOptional())).containsExactly(c3,c4);
}
代码示例来源:origin: debezium/debezium
@Test
public void shouldParseCreateTableStatementWithSingleGeneratedAndPrimaryKeyColumn() {
String ddl = "CREATE TABLE foo ( " + System.lineSeparator()
+ " c1 INTEGER GENERATED ALWAYS AS IDENTITY NOT NULL PRIMARY KEY, " + System.lineSeparator()
+ " c2 VARCHAR(22) " + System.lineSeparator()
+ "); " + System.lineSeparator();
parser.parse(ddl, tables);
assertThat(tables.size()).isEqualTo(1);
Table foo = tables.forTable(new TableId(null,null,"foo"));
assertThat(foo).isNotNull();
assertThat(foo.retrieveColumnNames()).containsExactly("c1","c2");
assertThat(foo.primaryKeyColumnNames()).containsExactly("c1");
assertColumn(foo,"c1","INTEGER",Types.INTEGER,-1,-1,false,true,true);
assertColumn(foo,"c2","VARCHAR",Types.VARCHAR,22,-1,true,false,false);
}
代码示例来源:origin: debezium/debezium
@Test
public void shouldMaintainSameOrder() throws InterruptedException {
BufferedBlockingConsumer<Integer> buffered = BufferedBlockingConsumer.bufferLast(consumer);
// Add several values ...
buffered.accept(1);
buffered.accept(2);
buffered.accept(3);
buffered.accept(4);
buffered.accept(5);
// And verify the history contains all but the last value ...
assertThat(history).containsExactly(1,2,3,4);
// Flush the last value...
buffered.close(i -> i);
// And verify the history contains the same values ...
assertThat(history).containsExactly(1,2,3,4,5);
}
代码示例来源:origin: debezium/debezium
@Test
public void shouldParseCreateTableStatementWithSignedTypes() {
String ddl = "CREATE TABLE foo ( " + System.lineSeparator()
+ " c1 BIGINT SIGNED NOT NULL, " + System.lineSeparator()
+ " c2 INT UNSIGNED NOT NULL " + System.lineSeparator()
+ "); " + System.lineSeparator();
parser.parse(ddl, tables);
assertThat(tables.size()).isEqualTo(1);
Table foo = tables.forTable(new TableId(null, null, "foo"));
assertThat(foo).isNotNull();
assertThat(foo.retrieveColumnNames()).containsExactly("c1", "c2");
assertThat(foo.primaryKeyColumnNames()).isEmpty();
assertColumn(foo, "c1", "BIGINT SIGNED", Types.BIGINT, -1, -1, false, false, false);
assertColumn(foo, "c2", "INT UNSIGNED", Types.INTEGER, -1, -1, false, false, false);
}
代码示例来源:origin: debezium/debezium
@Test
public void shouldParseCreateTableStatementWithSingleGeneratedAndPrimaryKeyColumn() {
String ddl = "CREATE TABLE foo ( " + System.lineSeparator()
+ " c1 INTEGER NOT NULL AUTO_INCREMENT, " + System.lineSeparator()
+ " c2 VARCHAR(22) " + System.lineSeparator()
+ "); " + System.lineSeparator();
parser.parse(ddl, tables);
assertThat(tables.size()).isEqualTo(1);
Table foo = tables.forTable(new TableId(null, null, "foo"));
assertThat(foo).isNotNull();
assertThat(foo.retrieveColumnNames()).containsExactly("c1", "c2");
assertThat(foo.primaryKeyColumnNames()).isEmpty();
assertColumn(foo, "c1", "INTEGER", Types.INTEGER, -1, -1, false, true, true);
assertColumn(foo, "c2", "VARCHAR", Types.VARCHAR, 22, -1, true, false, false);
}
代码示例来源:origin: debezium/debezium
@FixFor("DBZ-419")
@Test
public void shouldParseCreateTableWithUnnamedPrimaryKeyConstraint() {
final String ddl =
"CREATE TABLE IF NOT EXISTS tables_exception (table_name VARCHAR(100), create_date TIMESTAMP DEFAULT NOW(), enabled INT(1), retention int(1) default 30, CONSTRAINT PRIMARY KEY (table_name));";
parser.parse(ddl, tables);
Testing.print(tables);
Table t = tables.forTable(new TableId(null, null, "tables_exception"));
assertThat(t).isNotNull();
assertThat(t.primaryKeyColumnNames()).containsExactly("table_name");
assertThat(tables.size()).isEqualTo(1);
}
代码示例来源:origin: debezium/debezium
@Test
public void shouldParseCreateTableStatementWithCharacterSetForColumns() {
String ddl = "CREATE TABLE t ( col1 VARCHAR(25) CHARACTER SET greek ); ";
parser.parse(ddl, tables);
assertThat(tables.size()).isEqualTo(1);
Table t = tables.forTable(new TableId(null, null, "t"));
assertThat(t).isNotNull();
assertThat(t.retrieveColumnNames()).containsExactly("col1");
assertThat(t.primaryKeyColumnNames()).isEmpty();
assertColumn(t, "col1", "VARCHAR", Types.VARCHAR, 25, -1, true, false, false);
}
代码示例来源:origin: debezium/debezium
@Test
public void parseTableWithPageChecksum() {
String ddl =
"CREATE TABLE t (id INT NOT NULL, PRIMARY KEY (`id`)) PAGE_CHECKSUM=1;" +
"ALTER TABLE t PAGE_CHECKSUM=0;";
parser.parse(ddl, tables);
assertThat(tables.size()).isEqualTo(1);
Table t = tables.forTable(new TableId(null, null, "t"));
assertThat(t).isNotNull();
assertThat(t.retrieveColumnNames()).containsExactly("id");
assertThat(t.primaryKeyColumnNames()).hasSize(1);
assertColumn(t, "id", "INT", Types.INTEGER, -1, -1, false, false, false);
}
代码示例来源:origin: debezium/debezium
@Test
@FixFor("DBZ-429")
public void parseTableWithNegativeDefault() {
String ddl =
"CREATE TABLE t (id INT NOT NULL, myvalue INT DEFAULT -10, PRIMARY KEY (`id`));";
parser.parse(ddl, tables);
assertThat(tables.size()).isEqualTo(1);
Table t = tables.forTable(new TableId(null, null, "t"));
assertThat(t).isNotNull();
assertThat(t.retrieveColumnNames()).containsExactly("id", "myvalue");
assertThat(t.primaryKeyColumnNames()).hasSize(1);
assertColumn(t, "myvalue", "INT", Types.INTEGER, -1, -1, true, false, false);
}
代码示例来源:origin: debezium/debezium
@FixFor("DBZ-160")
@Test
public void shouldParseCreateTableWithEnumDefault() {
String ddl = "CREATE TABLE t ( c1 ENUM('a','b','c') NOT NULL DEFAULT 'b', c2 ENUM('a', 'b', 'c') NOT NULL DEFAULT 'a');";
parser.parse(ddl, tables);
assertThat(tables.size()).isEqualTo(1);
Table t = tables.forTable(new TableId(null, null, "t"));
assertThat(t).isNotNull();
assertThat(t.retrieveColumnNames()).containsExactly("c1", "c2");
assertThat(t.primaryKeyColumnNames()).isEmpty();
assertColumn(t, "c1", "ENUM", Types.CHAR, 1, -1, false, false, false);
assertColumn(t, "c2", "ENUM", Types.CHAR, 1, -1, false, false, false);
}
代码示例来源:origin: debezium/debezium
@FixFor("DBZ-160")
@Test
public void shouldParseCreateTableWithBitDefault() {
String ddl = "CREATE TABLE t ( c1 Bit(2) NOT NULL DEFAULT b'1', c2 Bit(2) NOT NULL);";
parser.parse(ddl, tables);
assertThat(tables.size()).isEqualTo(1);
Table t = tables.forTable(new TableId(null, null, "t"));
assertThat(t).isNotNull();
assertThat(t.retrieveColumnNames()).containsExactly("c1", "c2");
assertThat(t.primaryKeyColumnNames()).isEmpty();
assertColumn(t, "c1", "BIT", Types.BIT, 2, -1, false, false, false);
assertColumn(t, "c2", "BIT", Types.BIT, 2, -1, false, false, false);
}
代码示例来源:origin: debezium/debezium
@Test
public void parseDdlForDecAndFixed() {
String ddl = "CREATE TABLE t ( c1 DEC(2) NOT NULL, c2 FIXED(1,0) NOT NULL, c3 NUMERIC(3) NOT NULL);";
parser.parse(ddl, tables);
assertThat(tables.size()).isEqualTo(1);
Table t = tables.forTable(new TableId(null, null, "t"));
assertThat(t).isNotNull();
assertThat(t.retrieveColumnNames()).containsExactly("c1", "c2", "c3");
assertThat(t.primaryKeyColumnNames()).isEmpty();
assertColumn(t, "c1", "DEC", Types.DECIMAL, 2, 0, false, false, false);
assertColumn(t, "c2", "FIXED", Types.DECIMAL, 1, 0, false, false, false);
assertColumn(t, "c3", "NUMERIC", Types.NUMERIC, 3, 0, false, false, false);
}
代码示例来源:origin: debezium/debezium
@Test
@FixFor({"DBZ-615", "DBZ-727"})
public void parseDdlForUnscaledDecAndFixed() {
String ddl = "CREATE TABLE t ( c1 DEC NOT NULL, c2 FIXED(3) NOT NULL, c3 NUMERIC NOT NULL);";
parser.parse(ddl, tables);
assertThat(tables.size()).isEqualTo(1);
Table t = tables.forTable(new TableId(null, null, "t"));
assertThat(t).isNotNull();
assertThat(t.retrieveColumnNames()).containsExactly("c1", "c2", "c3");
assertThat(t.primaryKeyColumnNames()).isEmpty();
assertColumn(t, "c1", "DEC", Types.DECIMAL, 10, 0, false, false, false);
assertColumn(t, "c2", "FIXED", Types.DECIMAL, 3, 0, false, false, false);
assertColumn(t, "c3", "NUMERIC", Types.NUMERIC, 10, 0, false, false, false);
}
代码示例来源:origin: debezium/debezium
@Test
public void shouldFindGeneratedColumns() {
editor.tableId(id);
Column c1 = columnEditor.name("C1").type("VARCHAR").jdbcType(Types.VARCHAR).length(10).position(1).create();
Column c2 = columnEditor.name("C2").type("NUMBER").jdbcType(Types.NUMERIC).length(5).generated(true).create();
Column c3 = columnEditor.name("C3").type("DATE").jdbcType(Types.DATE).generated(true).create();
editor.addColumns(c1, c2, c3);
editor.setPrimaryKeyNames("C1");
table = editor.create();
assertThat(table.retrieveColumnNames()).containsExactly("C1", "C2", "C3");
table.columns().forEach(col -> {
assertThat(table.isGenerated(col.name())).isEqualTo(col.isGenerated());
});
assertValidPositions(editor);
}
代码示例来源:origin: debezium/debezium
@Test
public void shouldFindAutoIncrementedColumns() {
editor.tableId(id);
Column c1 = columnEditor.name("C1").type("VARCHAR").jdbcType(Types.VARCHAR).length(10).position(1).create();
Column c2 = columnEditor.name("C2").type("NUMBER").jdbcType(Types.NUMERIC).length(5).autoIncremented(true).create();
Column c3 = columnEditor.name("C3").type("DATE").jdbcType(Types.DATE).autoIncremented(true).create();
editor.addColumns(c1, c2, c3);
editor.setPrimaryKeyNames("C1");
table = editor.create();
assertThat(table.retrieveColumnNames()).containsExactly("C1", "C2", "C3");
table.columns().forEach(col -> {
assertThat(table.isAutoIncremented(col.name())).isEqualTo(col.isAutoIncremented());
});
assertValidPositions(editor);
}
代码示例来源:origin: debezium/debezium
@Test
public void shouldParseCreateTableWithEnumAndSetColumns() {
String ddl = "CREATE TABLE t ( c1 ENUM('a','b','c') NOT NULL, c2 SET('a','b','c') NULL);";
parser.parse(ddl, tables);
assertThat(tables.size()).isEqualTo(1);
Table t = tables.forTable(new TableId(null, null, "t"));
assertThat(t).isNotNull();
assertThat(t.retrieveColumnNames()).containsExactly("c1", "c2");
assertThat(t.primaryKeyColumnNames()).isEmpty();
assertColumn(t, "c1", "ENUM", Types.CHAR, 1, -1, false, false, false);
assertColumn(t, "c2", "SET", Types.CHAR, 5, -1, true, false, false);
assertThat(t.columnWithName("c1").position()).isEqualTo(1);
assertThat(t.columnWithName("c2").position()).isEqualTo(2);
}
代码示例来源:origin: debezium/debezium
@Test
public void shouldRemoveColumnByName() {
editor.tableId(id);
Column c1 = columnEditor.name("C1").type("VARCHAR").jdbcType(Types.VARCHAR).length(10).position(1).create();
Column c2 = columnEditor.name("C2").type("NUMBER").jdbcType(Types.NUMERIC).length(5).autoIncremented(true).create();
Column c3 = columnEditor.name("C3").type("DATE").jdbcType(Types.DATE).autoIncremented(true).create();
editor.addColumns(c1, c2, c3);
editor.removeColumn("C2");
assertThat(editor.columns()).containsExactly(editor.columnWithName("C1"),
editor.columnWithName("C3"));
assertValidPositions(editor);
}
内容来源于网络,如有侵权,请联系作者删除!