com.google.common.truth.IterableSubject Java Examples
The following examples show how to use
com.google.common.truth.IterableSubject.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SoyFunctionsTest.java From deploymentmanager-autogen with Apache License 2.0 | 5 votes |
@CheckReturnValue IterableSubject hasIterableResultThat() { try { return assertThat(((SoyList) callable.call()).asResolvedJavaList()); } catch (Exception e) { throw new AssertionError("Unexpected exception", e); } }
Example #2
Source File: BiStreamTest.java From mug with Apache License 2.0 | 5 votes |
private static IterableSubject assertSequential(Stream<?> stream) { assertThat(stream.isParallel()).isFalse(); ConcurrentMap<Long, Object> threads = new ConcurrentHashMap<>(); List<?> list = stream .peek( v -> { threads.put(Thread.currentThread().getId(), v); }) .collect(toList()); assertThat(threads).hasSize(1); return assertThat(list); }
Example #3
Source File: ToolchainContextSubject.java From bazel with Apache License 2.0 | 5 votes |
public IterableSubject toolchainTypeLabels() { return check("requiredToolchainTypes()") .that( actual.requiredToolchainTypes().stream() .map(ToolchainTypeInfo::typeLabel) .collect(Collectors.toList())); }
Example #4
Source File: CcCommonTest.java From bazel with Apache License 2.0 | 5 votes |
/** * Returns the {@link IterableSubject} for the {@link OutputGroupInfo#TEMP_FILES} generated when * {@code testTarget} is built for {@code cpu}. */ private IterableSubject assertTempsForTarget(String testTarget) throws Exception { useConfiguration("--save_temps"); ConfiguredTarget target = getConfiguredTarget(testTarget); assertThat(target).isNotNull(); List<String> temps = ActionsTestUtil.baseArtifactNames(getOutputGroup(target, OutputGroupInfo.TEMP_FILES)); // Return the IterableSubject for the temp files. return assertWithMessage("k8").that(temps); }
Example #5
Source File: ToolchainTestCase.java From bazel with Apache License 2.0 | 5 votes |
protected static IterableSubject assertToolchainLabels( RegisteredToolchainsValue registeredToolchainsValue, @Nullable PackageIdentifier packageRoot) { assertThat(registeredToolchainsValue).isNotNull(); ImmutableList<DeclaredToolchainInfo> declaredToolchains = registeredToolchainsValue.registeredToolchains(); List<Label> labels = collectToolchainLabels(declaredToolchains, packageRoot); return assertThat(labels); }
Example #6
Source File: RegisteredExecutionPlatformsFunctionTest.java From bazel with Apache License 2.0 | 5 votes |
protected static IterableSubject assertExecutionPlatformLabels( RegisteredExecutionPlatformsValue registeredExecutionPlatformsValue, @Nullable PackageIdentifier packageRoot) { assertThat(registeredExecutionPlatformsValue).isNotNull(); ImmutableList<ConfiguredTargetKey> declaredExecutionPlatformKeys = registeredExecutionPlatformsValue.registeredExecutionPlatformKeys(); List<Label> labels = collectExecutionPlatformLabels(declaredExecutionPlatformKeys, packageRoot); return assertThat(labels); }
Example #7
Source File: NodeEntrySubject.java From bazel with Apache License 2.0 | 4 votes |
public IterableSubject hasTemporaryDirectDepsThat() { return check("getTemporaryDirectDeps()") .that(Iterables.concat(actual.getTemporaryDirectDeps())); }
Example #8
Source File: TableBlockParserTest.java From js-dossier with Apache License 2.0 | 4 votes |
private static IterableSubject assertHeader(String str) { return assertThat(parseHeaderDivider(str)); }
Example #9
Source File: UserSubject.java From tutorials with MIT License | 4 votes |
public IterableSubject emails() { return Truth.assertThat(actual().getEmails()); }
Example #10
Source File: EventIterableSubjectFactory.java From bazel with Apache License 2.0 | 4 votes |
public static IterableSubject assertThatEvents(Iterable<Event> events) { return Truth.assertAbout(new EventIterableSubjectFactory()).that(events).hasEventsThat(); }
Example #11
Source File: EventIterableSubject.java From bazel with Apache License 2.0 | 4 votes |
IterableSubject hasEventsThat() { return assertThat(Iterables.transform(actual, Event::getMessage)); }
Example #12
Source File: ToolchainContextSubject.java From bazel with Apache License 2.0 | 4 votes |
public IterableSubject resolvedToolchainLabels() { return check("resolevdToolchainLabels()").that(actual.resolvedToolchainLabels()); }
Example #13
Source File: ToolchainCollectionSubject.java From bazel with Apache License 2.0 | 4 votes |
public IterableSubject resolvedToolchains() { return check("getResolvedToolchains()").that(actual.getResolvedToolchains()); }
Example #14
Source File: ToolchainTestCase.java From bazel with Apache License 2.0 | 4 votes |
protected static IterableSubject assertToolchainLabels( RegisteredToolchainsValue registeredToolchainsValue) { return assertToolchainLabels(registeredToolchainsValue, null); }
Example #15
Source File: RegisteredExecutionPlatformsFunctionTest.java From bazel with Apache License 2.0 | 4 votes |
protected static IterableSubject assertExecutionPlatformLabels( RegisteredExecutionPlatformsValue registeredExecutionPlatformsValue) { return assertExecutionPlatformLabels(registeredExecutionPlatformsValue, null); }
Example #16
Source File: ErrorInfoSubject.java From bazel with Apache License 2.0 | 4 votes |
public IterableSubject hasCycleInfoThat() { isNotNull(); return check("getCycleInfo()").that(actual.getCycleInfo()); }
Example #17
Source File: MetadataSubject.java From flogger with Apache License 2.0 | 4 votes |
public IterableSubject keys() { return check("keys()").that(keyList()); }
Example #18
Source File: CycleInfoSubject.java From bazel with Apache License 2.0 | 4 votes |
public IterableSubject hasCycleThat() { return check("getCycle()").that(actual.getCycle()); }
Example #19
Source File: CycleInfoSubject.java From bazel with Apache License 2.0 | 4 votes |
public IterableSubject hasPathToCycleThat() { return check("getPathToCycle()").that(actual.getPathToCycle()); }
Example #20
Source File: EvaluationResultSubject.java From bazel with Apache License 2.0 | 4 votes |
public IterableSubject hasReverseDepsInGraphThat(SkyKey child) throws InterruptedException { return check("reverseDeps(%s)", child) .that(actual.getWalkableGraph().getReverseDeps(ImmutableList.of(child)).get(child)); }
Example #21
Source File: EvaluationResultSubject.java From bazel with Apache License 2.0 | 4 votes |
public IterableSubject hasDirectDepsInGraphThat(SkyKey parent) throws InterruptedException { return check("directDeps(%s)", parent) .that(actual.getWalkableGraph().getDirectDeps(ImmutableList.of(parent)).get(parent)); }
Example #22
Source File: IntentSubject.java From android-test with Apache License 2.0 | 4 votes |
public final IterableSubject categories() { return check("getCategories()").that(actual.getCategories()); }
Example #23
Source File: BundleSubject.java From android-test with Apache License 2.0 | 4 votes |
public IterableSubject parcelableArrayList(String key) { return check("getParcelableArrayList(%s)", key).that(actual.getParcelableArrayList(key)); }
Example #24
Source File: BundleSubject.java From android-test with Apache License 2.0 | 4 votes |
public IterableSubject stringArrayList(String key) { return check("getStringArrayList(%s)", key).that(actual.getStringArrayList(key)); }
Example #25
Source File: WeirdAssertions.java From adventure with MIT License | 4 votes |
public static <T, U extends Iterable<V>, V> void forEachTransformAndAssertIterable(final Iterable<T> values, final Function<T, U> function, final Consumer<IterableSubject> consumer) { for(final T value : values) { consumer.accept(assertThat(function.apply(value))); } }
Example #26
Source File: MaybeTest.java From mug with Apache License 2.0 | 4 votes |
private static <T, E extends Throwable> IterableSubject assertStream( Stream<Maybe<T, E>> stream) throws E { return assertThat(collect(stream)); }
Example #27
Source File: ParallelizerTest.java From mug with Apache License 2.0 | 4 votes |
private IterableSubject shutdownAndAssertInterruptedKeys() throws InterruptedException { shutdownThreadPool(); // Allow left-over threads to respond to interruptions. return assertThat(interrupted); }
Example #28
Source File: MetadataSubject.java From flogger with Apache License 2.0 | 4 votes |
public IterableSubject values() { return check("values()").that(valueList()); }