diff --git a/android/guava-tests/test/com/google/common/graph/TraverserTest.java b/android/guava-tests/test/com/google/common/graph/TraverserTest.java index fa446dee5cb3..d4c8cf7521c3 100644 --- a/android/guava-tests/test/com/google/common/graph/TraverserTest.java +++ b/android/guava-tests/test/com/google/common/graph/TraverserTest.java @@ -383,8 +383,8 @@ public void forGraph_depthFirstPreOrderIterable_javadocExample_canBeIteratedMult @Test public void forGraph_depthFirstPreOrder_infinite() { Iterable result = - Traverser.forGraph(fixedSuccessors(Iterables.cycle(1, 2, 3))).breadthFirst(0); - assertThat(Iterables.limit(result, 2)).containsExactly(0, 1).inOrder(); + Traverser.forGraph(fixedSuccessors(Iterables.cycle(1, 2, 3))).depthFirstPreOrder(0); + assertThat(Iterables.limit(result, 3)).containsExactly(0, 1, 2).inOrder(); } @Test diff --git a/android/guava/src/com/google/common/graph/Traverser.java b/android/guava/src/com/google/common/graph/Traverser.java index 4257eb828023..0d8e6f97fa32 100644 --- a/android/guava/src/com/google/common/graph/Traverser.java +++ b/android/guava/src/com/google/common/graph/Traverser.java @@ -22,6 +22,7 @@ import com.google.common.annotations.Beta; import com.google.common.collect.AbstractIterator; import com.google.common.collect.ImmutableSet; +import com.google.errorprone.annotations.DoNotMock; import java.util.ArrayDeque; import java.util.Deque; import java.util.HashSet; @@ -59,6 +60,9 @@ * @since 23.1 */ @Beta +@DoNotMock( + "Call forGraph or forTree, passing a lambda or a Graph with the desired edges (built with" + + " GraphBuilder)") public abstract class Traverser { private final SuccessorsFunction successorFunction; diff --git a/guava-tests/test/com/google/common/graph/TraverserTest.java b/guava-tests/test/com/google/common/graph/TraverserTest.java index fa446dee5cb3..d4c8cf7521c3 100644 --- a/guava-tests/test/com/google/common/graph/TraverserTest.java +++ b/guava-tests/test/com/google/common/graph/TraverserTest.java @@ -383,8 +383,8 @@ public void forGraph_depthFirstPreOrderIterable_javadocExample_canBeIteratedMult @Test public void forGraph_depthFirstPreOrder_infinite() { Iterable result = - Traverser.forGraph(fixedSuccessors(Iterables.cycle(1, 2, 3))).breadthFirst(0); - assertThat(Iterables.limit(result, 2)).containsExactly(0, 1).inOrder(); + Traverser.forGraph(fixedSuccessors(Iterables.cycle(1, 2, 3))).depthFirstPreOrder(0); + assertThat(Iterables.limit(result, 3)).containsExactly(0, 1, 2).inOrder(); } @Test diff --git a/guava/src/com/google/common/graph/Traverser.java b/guava/src/com/google/common/graph/Traverser.java index 7ab5941c0f03..be0eecb5f6fd 100644 --- a/guava/src/com/google/common/graph/Traverser.java +++ b/guava/src/com/google/common/graph/Traverser.java @@ -22,6 +22,7 @@ import com.google.common.annotations.Beta; import com.google.common.collect.AbstractIterator; import com.google.common.collect.ImmutableSet; +import com.google.errorprone.annotations.DoNotMock; import java.util.ArrayDeque; import java.util.Deque; import java.util.HashSet; @@ -59,6 +60,9 @@ * @since 23.1 */ @Beta +@DoNotMock( + "Call forGraph or forTree, passing a lambda or a Graph with the desired edges (built with" + + " GraphBuilder)") public abstract class Traverser { private final SuccessorsFunction successorFunction;