Skip to content

Commit

Permalink
Automatic code cleanup.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 246168944
  • Loading branch information
cpovirk authored and copybara-github committed May 1, 2019
1 parent 2e97cc3 commit e0c8c82
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ public class CycleInfoSubject extends Subject<CycleInfoSubject, CycleInfo> {

public IterableSubject hasPathToCycleThat() {
return check("getPathToCycle()")
.that(getSubject().getPathToCycle())
.named("Path to cycle in " + actualAsString());
.withMessage("Path to cycle in " + actualAsString())
.that(getSubject().getPathToCycle());
}

public IterableSubject hasCycleThat() {
return check("getCycle()").that(getSubject().getCycle()).named("Cycle in " + actualAsString());
return check("getCycle()")
.withMessage("Cycle in " + actualAsString())
.that(getSubject().getCycle());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ public ErrorInfoSubject(FailureMetadata failureMetadata, ErrorInfo errorInfo) {

public ThrowableSubject hasExceptionThat() {
return check("getException()")
.that(getSubject().getException())
.named("Exception in " + actualAsString());
.withMessage("Exception in " + actualAsString())
.that(getSubject().getException());
}

public IterableSubject hasCycleInfoThat() {
isNotNull();
return check("getCycleInfo()")
.that(getSubject().getCycleInfo())
.named("CycleInfo in " + actualAsString());
.withMessage("CycleInfo in " + actualAsString())
.that(getSubject().getCycleInfo());
}

public void rootCauseOfExceptionIs(SkyKey key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
package com.google.devtools.build.skyframe;

import static com.google.common.truth.Fact.simpleFact;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static com.google.devtools.build.skyframe.ErrorInfoSubjectFactory.assertThatErrorInfo;

import com.google.common.collect.ImmutableList;
import com.google.common.truth.DefaultSubject;
import com.google.common.truth.FailureMetadata;
import com.google.common.truth.IterableSubject;
import com.google.common.truth.Subject;
Expand All @@ -45,8 +44,8 @@ public void hasNoError() {
}
}

public DefaultSubject hasEntryThat(SkyKey key) {
return assertThat(getSubject().get(key)).named("Entry for " + actualAsString());
public Subject<?, ?> hasEntryThat(SkyKey key) {
return assertWithMessage("Entry for " + actualAsString()).that(getSubject().get(key));
}

public ErrorInfoSubject hasErrorEntryForKeyThat(SkyKey key) {
Expand All @@ -55,14 +54,12 @@ public ErrorInfoSubject hasErrorEntryForKeyThat(SkyKey key) {
}

public IterableSubject hasDirectDepsInGraphThat(SkyKey parent) throws InterruptedException {
return assertThat(
getSubject().getWalkableGraph().getDirectDeps(ImmutableList.of(parent)).get(parent))
.named("Direct deps for " + parent + " in " + actualAsString());
return assertWithMessage("Direct deps for " + parent + " in " + actualAsString())
.that(getSubject().getWalkableGraph().getDirectDeps(ImmutableList.of(parent)).get(parent));
}

public IterableSubject hasReverseDepsInGraphThat(SkyKey child) throws InterruptedException {
return assertThat(
getSubject().getWalkableGraph().getReverseDeps(ImmutableList.of(child)).get(child))
.named("Reverse deps for " + child + " in " + actualAsString());
return assertWithMessage("Reverse deps for " + child + " in " + actualAsString())
.that(getSubject().getWalkableGraph().getReverseDeps(ImmutableList.of(child)).get(child));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
// limitations under the License.
package com.google.devtools.build.skyframe;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;

import com.google.common.collect.Iterables;
import com.google.common.truth.ComparableSubject;
import com.google.common.truth.DefaultSubject;
import com.google.common.truth.FailureMetadata;
import com.google.common.truth.IterableSubject;
import com.google.common.truth.Subject;
Expand All @@ -31,19 +30,19 @@ public class NodeEntrySubject extends Subject<NodeEntrySubject, NodeEntry> {
super(failureMetadata, nodeEntry);
}

public DefaultSubject hasVersionThat() {
return check("getVersion()").that(getSubject().getVersion()).named(detail("Version"));
public Subject<?, ?> hasVersionThat() {
return check("getVersion()").withMessage(detail("Version")).that(getSubject().getVersion());
}

public IterableSubject hasTemporaryDirectDepsThat() {
return assertThat(Iterables.concat(getSubject().getTemporaryDirectDeps()))
.named(detail("TemporaryDirectDeps"));
return assertWithMessage(detail("TemporaryDirectDeps"))
.that(Iterables.concat(getSubject().getTemporaryDirectDeps()));
}

public ComparableSubject<?, NodeEntry.DependencyState> addReverseDepAndCheckIfDone(
@Nullable SkyKey reverseDep) throws InterruptedException {
return assertThat(getSubject().addReverseDepAndCheckIfDone(reverseDep))
.named(detail("AddReverseDepAndCheckIfDone"));
return assertWithMessage(detail("AddReverseDepAndCheckIfDone"))
.that(getSubject().addReverseDepAndCheckIfDone(reverseDep));
}

private String detail(String descriptor) {
Expand Down

0 comments on commit e0c8c82

Please sign in to comment.