本文整理了Java中com.google.common.base.Verify.verify()
方法的一些代码示例,展示了Verify.verify()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Verify.verify()
方法的具体详情如下:
包路径:com.google.common.base.Verify
类名称:Verify
方法名:verify
[英]Ensures that expression is true, throwing a VerifyException with no message otherwise.
[中]确保表达式为true,在没有其他消息的情况下抛出VerifyException。
代码示例来源:origin: prestodb/presto
public Page getPage()
{
verify(page != null);
verify(state == ProcessBatchState.SUCCESS);
return page;
}
代码示例来源:origin: prestodb/presto
private static void reverse(Coordinate[] coordinates, int start, int end)
{
verify(start <= end, "start must be less or equal than end");
for (int i = start; i < start + ((end - start) / 2); i++) {
Coordinate buffer = coordinates[i];
coordinates[i] = coordinates[start + end - i - 1];
coordinates[start + end - i - 1] = buffer;
}
}
代码示例来源:origin: prestodb/presto
@Override
public TaskContext getTaskContextByTaskId(TaskId taskId)
{
TaskContext taskContext = taskContexts.get(taskId);
verify(taskContext != null, "task does not exist");
return taskContext;
}
代码示例来源:origin: prestodb/presto
ChildAggregatedMemoryContext(AggregatedMemoryContext parentMemoryContext)
{
verify(parentMemoryContext instanceof AbstractAggregatedMemoryContext);
this.parentMemoryContext = (AbstractAggregatedMemoryContext) requireNonNull(parentMemoryContext, "parentMemoryContext is null");
}
代码示例来源:origin: google/guava
public void testVerify_simple_success() {
verify(true);
}
代码示例来源:origin: google/guava
public void testVerify_simpleMessage_success() {
verify(true, "message");
}
代码示例来源:origin: google/guava
public void testVerify_complexMessage_success() {
verify(true, "%s", IGNORE_ME);
}
代码示例来源:origin: prestodb/presto
@Override
public void serialize(ColumnStatisticMetadata value, JsonGenerator gen, SerializerProvider serializers)
throws IOException
{
verify(value != null, "value is null");
gen.writeFieldName(serialize(value));
}
代码示例来源:origin: prestodb/presto
public DictionaryAwarePageProjection(PageProjection projection, Function<DictionaryBlock, DictionaryId> sourceIdFunction)
{
this.projection = requireNonNull(projection, "projection is null");
this.sourceIdFunction = sourceIdFunction;
verify(projection.isDeterministic(), "projection must be deterministic");
verify(projection.getInputChannels().size() == 1, "projection must have only one input");
}
代码示例来源:origin: prestodb/presto
private ActualProperties deriveProperties(PlanNode result, List<ActualProperties> inputProperties)
{
// TODO: move this logic to PlanSanityChecker once PropertyDerivations.deriveProperties fully supports local exchanges
ActualProperties outputProperties = PropertyDerivations.deriveProperties(result, inputProperties, metadata, session, types, parser);
verify(result instanceof SemiJoinNode || inputProperties.stream().noneMatch(ActualProperties::isNullsAndAnyReplicated) || outputProperties.isNullsAndAnyReplicated(),
"SemiJoinNode is the only node that can strip null replication");
return outputProperties;
}
代码示例来源:origin: prestodb/presto
private void buildPage()
{
verify(outputPage == null);
verify(probe != null);
if (pageBuilder.isEmpty()) {
return;
}
outputPage = pageBuilder.build(probe);
pageBuilder.reset();
}
代码示例来源:origin: prestodb/presto
private SliceInput getDelegate()
{
if (delegate == null) {
delegate = requireNonNull(loader.get(), "loader returned a null stream");
verify(delegate.length() == globalLength, "loader returned stream of length %s, but length %s was expected", delegate.length(), globalLength);
delegate.setPosition(initialPosition);
}
return delegate;
}
代码示例来源:origin: google/guava
public void testVerify_simple_failure() {
try {
verify(false);
fail();
} catch (VerifyException expected) {
}
}
代码示例来源:origin: prestodb/presto
public GetDictionaryGroupIdsWork(Page page)
{
this.page = requireNonNull(page, "page is null");
verify(canProcessDictionary(page), "invalid call to processDictionary");
this.dictionaryBlock = (DictionaryBlock) page.getBlock(channels[0]);
updateDictionaryLookBack(dictionaryBlock.getDictionary());
this.dictionaryPage = createPageWithExtractedDictionary(page);
// we know the exact size required for the block
this.blockBuilder = BIGINT.createFixedSizeBlockBuilder(page.getPositionCount());
}
代码示例来源:origin: prestodb/presto
@Nullable
public static Envelope deserializeEnvelope(Slice shape)
{
requireNonNull(shape, "shape is null");
BasicSliceInput input = shape.getInput();
verify(input.available() > 0);
int length = input.available() - 1;
GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte());
return getEnvelope(input, type, length);
}
代码示例来源:origin: google/guava
public void testFromNonFluentFuture() throws Exception {
ListenableFuture<String> f =
new SimpleForwardingListenableFuture<String>(immediateFuture("a")) {};
verify(!(f instanceof FluentFuture));
assertThat(FluentFuture.from(f).get()).isEqualTo("a");
// TODO(cpovirk): Test forwarding more extensively.
}
代码示例来源:origin: google/guava
public void testVerify_complexMessage_failure() {
try {
verify(false, FORMAT, 5);
fail();
} catch (VerifyException expected) {
checkMessage(expected);
}
}
代码示例来源:origin: prestodb/presto
private ColumnStatisticsAggregation createAggregation(QualifiedName functionName, SymbolReference input, Type inputType, Type outputType)
{
Signature signature = metadata.getFunctionRegistry().resolveFunction(functionName, TypeSignatureProvider.fromTypes(ImmutableList.of(inputType)));
Type resolvedType = metadata.getType(getOnlyElement(signature.getArgumentTypes()));
verify(resolvedType.equals(inputType), "resolved function input type does not match the input type: %s != %s", resolvedType, inputType);
return new ColumnStatisticsAggregation(
new AggregationNode.Aggregation(
new FunctionCall(functionName, ImmutableList.of(input)),
signature,
Optional.empty()),
outputType);
}
代码示例来源:origin: google/guava
public void testVerify_simpleMessage_failure() {
try {
verify(false, "message");
fail();
} catch (VerifyException expected) {
assertThat(expected).hasMessageThat().isEqualTo("message");
}
}
代码示例来源:origin: prestodb/presto
@Override
public PlanWithProperties visitSpatialJoin(SpatialJoinNode node, HashComputationSet parentPreference)
{
PlanWithProperties left = planAndEnforce(node.getLeft(), new HashComputationSet(), true, new HashComputationSet());
PlanWithProperties right = planAndEnforce(node.getRight(), new HashComputationSet(), true, new HashComputationSet());
verify(left.getHashSymbols().isEmpty(), "probe side of the spatial join should not include hash symbols");
verify(right.getHashSymbols().isEmpty(), "build side of the spatial join should not include hash symbols");
return new PlanWithProperties(
replaceChildren(node, ImmutableList.of(left.getNode(), right.getNode())),
ImmutableMap.of());
}
内容来源于网络,如有侵权,请联系作者删除!