当前位置: 首页>>代码示例>>Java>>正文


Java Subject类代码示例

本文整理汇总了Java中com.google.common.truth.Subject的典型用法代码示例。如果您正苦于以下问题:Java Subject类的具体用法?Java Subject怎么用?Java Subject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Subject类属于com.google.common.truth包,在下文中一共展示了Subject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: assertToolchainResolution

import com.google.common.truth.Subject; //导入依赖的package包/类
private Subject<DefaultSubject, Object> assertToolchainResolution(
    Label toolchainType,
    Iterable<ConstraintValueInfo> targetConstraints,
    Iterable<ConstraintValueInfo> execConstraints,
    ImmutableList<DeclaredToolchainInfo> toolchains)
    throws Exception {

  PlatformInfo execPlatform =
      PlatformInfo.builder()
          .setLabel(makeLabel("//platform:exec"))
          .addConstraints(execConstraints)
          .build();
  PlatformInfo targetPlatform =
      PlatformInfo.builder()
          .setLabel(makeLabel("//platform:target"))
          .addConstraints(targetConstraints)
          .build();

  DeclaredToolchainInfo resolvedToolchain =
      ToolchainResolutionFunction.resolveConstraints(
          toolchainType, execPlatform, targetPlatform, toolchains, null);
  return assertThat(resolvedToolchain);
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:24,代码来源:ToolchainResolutionFunctionTest.java

示例2: assertCompleted

import com.google.common.truth.Subject; //导入依赖的package包/类
static Subject<?, Object> assertCompleted(CompletionStage<?> stage)
    throws InterruptedException, ExecutionException {
  assertThat(stage.toCompletableFuture().isDone()).isTrue();
  Object result = stage.toCompletableFuture().get();
  assertThat(stage.toCompletableFuture().isCancelled()).isFalse();
  assertThat(stage.toCompletableFuture().isCompletedExceptionally()).isFalse();
  return assertThat(result);
}
 
开发者ID:google,项目名称:mug,代码行数:9,代码来源:FutureAssertions.java

示例3: assertAfterCompleted

import com.google.common.truth.Subject; //导入依赖的package包/类
static Subject<?, Object> assertAfterCompleted(CompletionStage<?> stage)
    throws InterruptedException, ExecutionException {
  Object result = stage.toCompletableFuture().get();
  assertThat(stage.toCompletableFuture().isDone()).isTrue();
  assertThat(stage.toCompletableFuture().isCancelled()).isFalse();
  assertThat(stage.toCompletableFuture().isCompletedExceptionally()).isFalse();
  return assertThat(result);
}
 
开发者ID:google,项目名称:mug,代码行数:9,代码来源:FutureAssertions.java

示例4: assertThat

import com.google.common.truth.Subject; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <S extends Subject<S, E>, E> ListSubject<S, E> assertThat(
    List<E> list, Function<E, S> elementAssertThatFunction) {
  // The ListSubjectFactory always returns ListSubjects.
  // -> Casting is appropriate.
  return (ListSubject<S, E>)
      assertAbout(new ListSubjectFactory<>(elementAssertThatFunction)).that(list);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:ListSubject.java

示例5: providedValue

import com.google.common.truth.Subject; //导入依赖的package包/类
/**
 * Allows for assertions on the value provided by this provider.
 *
 * <p>The value provided by a checked provider is the object returned by a call to {@link
 * CheckedProvider#get}
 *
 * @return a {@link Subject} for asserting against the return value of {@link CheckedProvider#get}
 */
public Subject<?, Object> providedValue() {
  P provider = actual();
  T got;
  try {
    got = provider.get();
  } catch (Exception e) {
    failWithRawMessageAndCause(
        String.format("checked provider <%s> threw an exception", provider), e);
    return ignoreCheck().that(new Object());
  }
  return check().withMessage("value provided by <%s>", provider).that(got);
}
 
开发者ID:google,项目名称:guice,代码行数:21,代码来源:CheckedProviderSubject.java

示例6: classNames

import com.google.common.truth.Subject; //导入依赖的package包/类
static Subject.Factory<ClassNameSubject, String> classNames(Path basePath) {
  return new Subject.Factory<ClassNameSubject, String>() {
    @Override
    public ClassNameSubject createSubject(FailureMetadata metadata, String actual) {
      return new ClassNameSubject(metadata, basePath, actual);
    }
  };
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:9,代码来源:ClassPathsSubject.java

示例7: assertThat

import com.google.common.truth.Subject; //导入依赖的package包/类
private static Subject<DefaultSubject, Object> assertThat(Object subject) {
  return Truth.assertThat(subject);
}
 
开发者ID:bazelbuild,项目名称:rules_closure,代码行数:4,代码来源:WebpathTest.java

示例8: assertThat

import com.google.common.truth.Subject; //导入依赖的package包/类
public static Subject<DefaultSubject, Object> assertThat(@Nullable Object target) {
    return assert_().that(target);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:TruthHelper.java

示例9: booleanFormulasOf

import com.google.common.truth.Subject; //导入依赖的package包/类
/**
 * Use this for checking assertions about BooleanFormulas (given the corresponding solver) with
 * Truth: <code>assert_().about(booleanFormulasOf(context)).that(formula).is...()</code>.
 */
public static Subject.Factory<BooleanFormulaSubject, BooleanFormula> booleanFormulasOf(
    final SolverContext context) {
  return (metadata, formula) -> new BooleanFormulaSubject(metadata, formula, context);
}
 
开发者ID:sosy-lab,项目名称:java-smt,代码行数:9,代码来源:BooleanFormulaSubject.java

示例10: proverEnvironments

import com.google.common.truth.Subject; //导入依赖的package包/类
/**
 * Use this for checking assertions about ProverEnvironments with Truth: <code>
 * assert_().about(proverEnvironments()).that(stack).is...()</code>.
 */
public static Subject.Factory<ProverEnvironmentSubject, BasicProverEnvironment<?>>
    proverEnvironments() {
  return (metadata, formula) -> new ProverEnvironmentSubject(metadata, formula);
}
 
开发者ID:sosy-lab,项目名称:java-smt,代码行数:9,代码来源:ProverEnvironmentSubject.java

示例11: assertThat

import com.google.common.truth.Subject; //导入依赖的package包/类
public static <S extends Subject<S, ? super T>, T> OptionalSubject<S, T> assertThat(
    Optional<T> optional, Function<? super T, ? extends S> elementAssertThatFunction) {
  OptionalSubjectFactory<S, T> optionalSubjectFactory =
      new OptionalSubjectFactory<>(elementAssertThatFunction);
  return assertAbout(optionalSubjectFactory).that(optional);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:7,代码来源:OptionalSubject.java

示例12: types

import com.google.common.truth.Subject; //导入依赖的package包/类
public static Subject.Factory<TypeSubject, TypeI> types() {
  return TypeSubject::new;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:4,代码来源:TypeSubject.java

示例13: checkedProviders

import com.google.common.truth.Subject; //导入依赖的package包/类
public static <T, P extends CheckedProvider<T>>
    Subject.Factory<CheckedProviderSubject<T, P>, P> checkedProviders() {
  return new CheckedProviderSubjectFactory<>();
}
 
开发者ID:google,项目名称:guice,代码行数:5,代码来源:CheckedProviderSubject.java

示例14: deadline

import com.google.common.truth.Subject; //导入依赖的package包/类
public static Subject.Factory<DeadlineSubject, Deadline> deadline() {
  return deadlineFactory;
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:4,代码来源:DeadlineSubject.java

示例15: paths

import com.google.common.truth.Subject; //导入依赖的package包/类
/** Returns the subject factory for doing assertions on paths. */
public static Subject.Factory<PathSubject, Path> paths() {
  return new PathSubjectFactory();
}
 
开发者ID:google,项目名称:jimfs,代码行数:5,代码来源:PathSubject.java


注:本文中的com.google.common.truth.Subject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。