本文整理了Java中org.testng.Assert.assertEquals()
方法的一些代码示例,展示了Assert.assertEquals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.assertEquals()
方法的具体详情如下:
包路径:org.testng.Assert
类名称:Assert
方法名:assertEquals
[英]Asserts that two bytes are equal. If they are not, an AssertionError is thrown.
[中]断言两个字节相等。如果不是,则抛出断言错误。
代码示例来源:origin: prestodb/presto
@Test
public void testGroupByNanArray()
{
MaterializedResult actual = computeActual("SELECT a FROM (VALUES (ARRAY[nan(), 2e0, 3e0]), (ARRAY[nan(), 2e0, 3e0])) t(a) GROUP BY a");
List<MaterializedRow> actualRows = actual.getMaterializedRows();
assertEquals(actualRows.size(), 1);
assertTrue(Double.isNaN(((List<Double>) actualRows.get(0).getField(0)).get(0)));
assertEquals(((List<Double>) actualRows.get(0).getField(0)).get(1), 2.0);
assertEquals(((List<Double>) actualRows.get(0).getField(0)).get(2), 3.0);
}
代码示例来源:origin: prestodb/presto
@Test
public void testExampleSystemTable()
{
assertQuery("SELECT name FROM sys.example", "SELECT 'test' AS name");
MaterializedResult result = computeActual("SHOW SCHEMAS");
assertTrue(result.getOnlyColumnAsSet().containsAll(ImmutableSet.of("sf100", "tiny", "sys")));
result = computeActual("SHOW TABLES FROM sys");
assertEquals(result.getOnlyColumnAsSet(), ImmutableSet.of("example"));
}
代码示例来源:origin: spring-projects/spring-framework
@Test
@Transactional(propagation = Propagation.NOT_SUPPORTED)
void autowiringFromConfigClass() {
assertNotNull(employee, "The employee should have been autowired.");
assertEquals(employee.getName(), "John Smith");
assertNotNull(pet, "The pet should have been autowired.");
assertEquals(pet.getName(), "Fido");
}
代码示例来源:origin: prestodb/presto
private static void assertColumnList(List<com.amazonaws.services.glue.model.Column> actual, List<Column> expected)
{
if (expected == null) {
assertNull(actual);
}
assertEquals(actual.size(), expected.size());
for (int i = 0; i < expected.size(); i++) {
assertColumn(actual.get(i), expected.get(i));
}
}
代码示例来源:origin: prestodb/presto
@Test
public void testSQLException()
{
config.setControlGateway("invalid:url");
List<QueryPair> rewrittenQueries = rewriteQueries(parser, config, queryPairs);
assertEquals(rewrittenQueries.size(), 0);
}
}
代码示例来源:origin: prestodb/presto
@Test
public void testScheduleLocal()
{
Split split = new Split(CONNECTOR_ID, TestingTransactionHandle.create(), new TestSplitLocal());
Set<Split> splits = ImmutableSet.of(split);
Map.Entry<Node, Split> assignment = Iterables.getOnlyElement(nodeSelector.computeAssignments(splits, ImmutableList.copyOf(taskMap.values())).getAssignments().entries());
assertEquals(assignment.getKey().getHostAndPort(), split.getAddresses().get(0));
assertEquals(assignment.getValue(), split);
}
代码示例来源:origin: swagger-api/swagger-core
@Test(description = "it should desserialize Long schema correctly")
public void deserializeLongSchema() throws IOException {
final String jsonString = ResourceUtils.loadClassResource(getClass(), "specFiles/oas3_2.yaml");
final OpenAPI swagger = Yaml.mapper().readValue(jsonString, OpenAPI.class);
assertNotNull(swagger);
Schema s = swagger.getPaths().get("/withIntegerEnum/{stage}").getGet().getParameters().get(0).getSchema();
assertEquals(s.getEnum().get(0), 2147483647);
assertEquals(s.getEnum().get(1), 3147483647L);
assertEquals(s.getEnum().get(2), 31474836475505055L);
}
代码示例来源:origin: swagger-api/swagger-core
@Test
public void getRepeatableAnnotationsArrayTest() {
Tag[] annotations = ReflectionUtils.getRepeatableAnnotationsArray(InheritingClass.class, Tag.class);
Assert.assertNotNull(annotations);
Assert.assertTrue(annotations.length == 1);
Assert.assertNotNull(annotations[0]);
Assert.assertEquals("inherited tag", annotations[0].name());
}
代码示例来源:origin: prestodb/presto
@Test
public void testJsonRoundTrip()
{
MongoSplit expected = new MongoSplit(new SchemaTableName("schema1", "table1"), TupleDomain.all(), ImmutableList.of());
String json = codec.toJson(expected);
MongoSplit actual = codec.fromJson(json);
assertEquals(actual.getSchemaTableName(), expected.getSchemaTableName());
assertEquals(actual.getTupleDomain(), TupleDomain.<ColumnHandle>all());
assertEquals(actual.getAddresses(), ImmutableList.of());
}
}
代码示例来源:origin: prestodb/presto
private static void assertPathToken(String fieldName)
{
assertTrue(fieldName.indexOf('"') < 0);
assertEquals(tokenizePath("$." + fieldName), ImmutableList.of(fieldName));
assertEquals(tokenizePath("$.foo." + fieldName + ".bar"), ImmutableList.of("foo", fieldName, "bar"));
assertPathTokenQuoting(fieldName);
}
代码示例来源:origin: spring-projects/spring-framework
@Test
@Transactional(propagation = Propagation.NOT_SUPPORTED)
void verifyResourceAnnotationInjectedFields() {
assertInTransaction(false);
assertEquals(foo, "Foo", "The foo field should have been injected via @Resource.");
}
代码示例来源:origin: prestodb/presto
@Test
public void testGroupByNanRow()
{
MaterializedResult actual = computeActual("SELECT a, b, c FROM (VALUES ROW(nan(), 1, 2), ROW(nan(), 1, 2)) t(a, b, c) GROUP BY 1, 2, 3");
List<MaterializedRow> actualRows = actual.getMaterializedRows();
assertEquals(actualRows.size(), 1);
assertTrue(Double.isNaN((Double) actualRows.get(0).getField(0)));
assertEquals(actualRows.get(0).getField(1), 1);
assertEquals(actualRows.get(0).getField(2), 2);
}
代码示例来源:origin: prestodb/presto
private static void assertColumnList(List<Column> actual, List<com.amazonaws.services.glue.model.Column> expected)
{
if (expected == null) {
assertNull(actual);
}
assertEquals(actual.size(), expected.size());
for (int i = 0; i < expected.size(); i++) {
assertColumn(actual.get(i), expected.get(i));
}
}
代码示例来源:origin: prestodb/presto
@Test
public void testSingleThread()
{
config.setControlGateway(URL);
config.setThreadCount(1);
List<QueryPair> rewrittenQueries = rewriteQueries(parser, config, queryPairs);
assertEquals(rewrittenQueries.size(), queryPairs.size());
}
代码示例来源:origin: prestodb/presto
@Test
public void testEmptyBuildSql()
throws SQLException
{
TupleDomain<ColumnHandle> tupleDomain = TupleDomain.withColumnDomains(ImmutableMap.of(
columns.get(0), Domain.all(BIGINT),
columns.get(1), Domain.onlyNull(DOUBLE)));
Connection connection = database.getConnection();
try (PreparedStatement preparedStatement = new QueryBuilder("\"").buildSql(jdbcClient, connection, "", "", "test_table", columns, tupleDomain, Optional.empty());
ResultSet resultSet = preparedStatement.executeQuery()) {
assertEquals(resultSet.next(), false);
}
}
代码示例来源:origin: prestodb/presto
@Test
public void testIterator()
{
WorkProcessor<Integer> processor = processorFrom(ImmutableList.of(
ProcessState.ofResult(1),
ProcessState.ofResult(2),
ProcessState.finished()));
Iterator<Integer> iterator = processor.iterator();
assertTrue(iterator.hasNext());
assertEquals(iterator.next(), (Integer) 1);
assertTrue(iterator.hasNext());
assertEquals(iterator.next(), (Integer) 2);
assertFalse(iterator.hasNext());
}
代码示例来源:origin: prestodb/presto
@Test
public void testGetUpdateCount()
throws Exception
{
try (Connection connection = createConnection()) {
try (Statement statement = connection.createStatement()) {
assertTrue(statement.execute("SELECT 123 x, 'foo' y"));
assertEquals(statement.getUpdateCount(), -1);
assertEquals(statement.getLargeUpdateCount(), -1);
}
}
}
代码示例来源:origin: prestodb/presto
@Test
public void testJoinOrder()
{
PlanBuilder planBuilder = new PlanBuilder(new PlanNodeIdAllocator(), dummyMetadata());
TableScanNode a = planBuilder.tableScan(emptyList(), emptyMap());
TableScanNode b = planBuilder.tableScan(emptyList(), emptyMap());
List<PlanNodeId> order = scheduleOrder(planBuilder.join(JoinNode.Type.INNER, a, b));
assertEquals(order, ImmutableList.of(b.getId(), a.getId()));
}
代码示例来源:origin: spring-projects/spring-framework
@Test
void autowiringFromConfigClass() {
assertNotNull(employee, "The employee should have been autowired.");
assertEquals(employee.getName(), "John Smith");
assertNotNull(pet, "The pet should have been autowired.");
assertEquals(pet.getName(), "Fido");
}
代码示例来源:origin: spring-projects/spring-framework
@Test
@Transactional(propagation = Propagation.NOT_SUPPORTED)
void verifyResourceAnnotationInjectedMethods() {
assertInTransaction(false);
assertEquals(bar, "Bar", "The setBar() method should have been injected via @Resource.");
}
内容来源于网络,如有侵权,请联系作者删除!