本文整理了Java中org.testng.Assert.assertFalse()
方法的一些代码示例,展示了Assert.assertFalse()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.assertFalse()
方法的具体详情如下:
包路径:org.testng.Assert
类名称:Assert
方法名:assertFalse
[英]Asserts that a condition is false. If it isn't, an AssertionError is thrown.
[中]断言某个条件为假。如果不是,则抛出断言错误。
代码示例来源:origin: prestodb/presto
private void checkRepresentation(String expression, int expectedSqlType, ResultAssertion assertion)
throws Exception
{
try (ResultSet rs = statement.executeQuery("SELECT " + expression)) {
ResultSetMetaData metadata = rs.getMetaData();
assertEquals(metadata.getColumnCount(), 1);
assertEquals(metadata.getColumnType(1), expectedSqlType);
assertTrue(rs.next());
assertion.accept(rs, 1);
assertFalse(rs.next());
}
}
代码示例来源:origin: prestodb/presto
public void testInvalidGetPartitionsByNames()
{
Map<String, Optional<Partition>> partitionsByNames = metastore.getPartitionsByNames(BAD_DATABASE, TEST_TABLE, ImmutableList.of(TEST_PARTITION1));
assertEquals(partitionsByNames.size(), 1);
Optional<Partition> onlyElement = Iterables.getOnlyElement(partitionsByNames.values());
assertFalse(onlyElement.isPresent());
}
代码示例来源:origin: prestodb/presto
@Test
public void testNonDeterministicScalarParse()
{
List<SqlScalarFunction> functions = ScalarFromAnnotationsParser.parseFunctionDefinition(NonDeterministicScalarFunction.class);
assertEquals(functions.size(), 1);
ParametricScalar scalar = (ParametricScalar) functions.get(0);
assertFalse(scalar.isDeterministic());
assertFalse(scalar.isHidden());
}
代码示例来源:origin: prestodb/presto
@Test
public void testBloomFilterPredicateValuesNonExisting()
{
BloomFilter bloomFilter = new BloomFilter(TEST_VALUES.size() * 10, 0.01);
for (Map.Entry<Object, Type> testValue : TEST_VALUES.entrySet()) {
boolean matched = checkInBloomFilter(bloomFilter, testValue.getKey(), testValue.getValue());
assertFalse(matched, "type " + testValue.getKey().getClass());
}
// test unsupported type: can be supported by ORC but is not implemented yet
assertTrue(checkInBloomFilter(bloomFilter, new Date(), DATE), "unsupported type DATE should always return true");
}
代码示例来源:origin: prestodb/presto
@Test
public void testEmptyInput()
{
GroupedTopNBuilder groupedTopNBuilder = new GroupedTopNBuilder(
ImmutableList.of(BIGINT),
(left, leftPosition, right, rightPosition) -> {
throw new UnsupportedOperationException();
},
5,
false,
new NoChannelGroupByHash());
assertFalse(groupedTopNBuilder.buildResult().hasNext());
}
代码示例来源:origin: prestodb/presto
private void assertCallFails(@Language("SQL") String sql, String message)
{
tester.reset();
try {
assertUpdate(sql);
fail("expected exception");
}
catch (RuntimeException e) {
assertFalse(tester.wasCalled());
assertEquals(e.getMessage(), message);
}
}
代码示例来源:origin: prestodb/presto
@Test
public void testCatalog()
{
QualifiedTablePrefix tableName = new QualifiedTablePrefix("catalog");
assertEquals("catalog", tableName.getCatalogName());
assertFalse(tableName.hasSchemaName());
assertFalse(tableName.hasTableName());
}
代码示例来源:origin: swagger-api/swagger-core
@Test(description = "it should override an inherited model's name")
public void overrideInheritedModelName() {
final Map<String, Schema> rootSchemas = readAll(AbstractModelWithApiModel.class);
assertEquals(rootSchemas.size(), 3);
assertTrue(rootSchemas.containsKey("MyProperty"));
assertTrue(rootSchemas.containsKey("ModelWithUrlProperty"));
assertTrue(rootSchemas.containsKey("ModelWithValueProperty"));
final Map<String, Schema> nestedSchemas = readAll(ModelWithUrlProperty.class);
assertEquals(nestedSchemas.size(), 1);
assertTrue(nestedSchemas.containsKey("ModelWithUrlProperty"));
assertFalse(nestedSchemas.containsKey("MyProperties"));
}
代码示例来源:origin: prestodb/presto
@Test
public void testIsCompressionCodecSupported()
{
assertTrue(S3SelectPushdown.isCompressionCodecSupported(inputFormat, new Path("s3://fakeBucket/fakeObject.gz")));
assertTrue(S3SelectPushdown.isCompressionCodecSupported(inputFormat, new Path("s3://fakeBucket/fakeObject")));
assertFalse(S3SelectPushdown.isCompressionCodecSupported(inputFormat, new Path("s3://fakeBucket/fakeObject.lz4")));
assertFalse(S3SelectPushdown.isCompressionCodecSupported(inputFormat, new Path("s3://fakeBucket/fakeObject.snappy")));
assertTrue(S3SelectPushdown.isCompressionCodecSupported(inputFormat, new Path("s3://fakeBucket/fakeObject.bz2")));
}
}
代码示例来源:origin: prestodb/presto
@Test(timeOut = 5000)
public void testMergeSortedEmptyStreamsWithFinishedOnly()
{
List<ProcessState<Integer>> firstStream = ImmutableList.of(
ProcessState.finished());
List<ProcessState<Integer>> secondStream = ImmutableList.of(
ProcessState.finished());
WorkProcessor<Integer> mergedStream = WorkProcessorUtils.mergeSorted(
ImmutableList.of(processorFrom(firstStream), processorFrom(secondStream)),
Comparator.comparingInt(firstInteger -> firstInteger));
// before
assertFalse(mergedStream.isBlocked());
assertFalse(mergedStream.isFinished());
assertFinishes(mergedStream);
}
代码示例来源:origin: prestodb/presto
public void assertDecodedAs(String jsonValue, Type type, boolean expectedValue)
{
checkArgument(type.getJavaType() == boolean.class, "Wrong (not boolean based) presto type '%s'", type);
FieldValueProvider decodedValue = decode(Optional.of(jsonValue), type);
assertFalse(decodedValue.isNull(), format("expected non null when decoding %s as %s", jsonValue, type));
assertEquals(decodedValue.getBoolean(), expectedValue);
}
代码示例来源:origin: prestodb/presto
public static <T> void assertResult(WorkProcessor<T> processor, T result)
{
assertTrue(processor.process());
assertFalse(processor.isBlocked());
assertFalse(processor.isFinished());
assertEquals(processor.getResult(), result);
}
代码示例来源:origin: prestodb/presto
@Test
public void testIsOriginalOrder()
{
assertTrue(isOriginalOrder(ImmutableList.of(0, 1, 2, 3, 4)));
assertFalse(isOriginalOrder(ImmutableList.of(0, 2, 1, 3, 4)));
}
代码示例来源:origin: prestodb/presto
@Test
public void testOverlaps()
{
AllOrNoneValueSet all = AllOrNoneValueSet.all(HYPER_LOG_LOG);
AllOrNoneValueSet none = AllOrNoneValueSet.none(HYPER_LOG_LOG);
assertTrue(all.overlaps(all));
assertFalse(all.overlaps(none));
assertFalse(none.overlaps(all));
assertFalse(none.overlaps(none));
}
代码示例来源:origin: prestodb/presto
public void assertDecodedAs(String jsonValue, Type type, double expectedValue)
{
checkArgument(type.getJavaType() == double.class, "Wrong (not double based) presto type '%s'", type);
FieldValueProvider decodedValue = decode(Optional.of(jsonValue), type);
assertFalse(decodedValue.isNull(), format("expected non null when decoding %s as %s", jsonValue, type));
assertEquals(decodedValue.getDouble(), expectedValue);
}
代码示例来源: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 testIsS3FileSystem()
{
HdfsEnvironment hdfsEnvironment = createTestHdfsEnvironment(new HiveClientConfig());
assertTrue(isS3FileSystem(CONTEXT, hdfsEnvironment, new Path("s3://test-bucket/test-folder")));
assertFalse(isS3FileSystem(CONTEXT, hdfsEnvironment, new Path("/test-dir/test-folder")));
}
代码示例来源:origin: prestodb/presto
public void assertDecodedAs(String jsonValue, Type type, long expectedValue)
{
checkArgument(type.getJavaType() == long.class, "Wrong (not long based) presto type '%s'", type);
FieldValueProvider decodedValue = decode(Optional.of(jsonValue), type);
assertFalse(decodedValue.isNull(), format("expected non null when decoding %s as %s", jsonValue, type));
assertEquals(decodedValue.getLong(), expectedValue);
}
代码示例来源:origin: prestodb/presto
@Test
public void testEmptyCursor()
{
ListBasedRecordSet recordSet = new ListBasedRecordSet(ImmutableList.of(), ImmutableList.of(BIGINT, INTEGER));
assertEquals(recordSet.getColumnTypes(), ImmutableList.of(BIGINT, INTEGER));
RecordCursor cursor = recordSet.cursor();
assertFalse(cursor.advanceNextPosition());
}
代码示例来源:origin: prestodb/presto
@Test
public void testStatsExtraction()
throws Exception
{
try (PrestoResultSet rs = (PrestoResultSet) statement.executeQuery("SELECT 123 x, 456 x")) {
assertNotNull(rs.getStats());
assertTrue(rs.next());
assertNotNull(rs.getStats());
assertFalse(rs.next());
assertNotNull(rs.getStats());
}
}
内容来源于网络,如有侵权,请联系作者删除!