Skip to content

Commit

Permalink
Add @DoNotMock to Traverser.
Browse files Browse the repository at this point in the history
RELNOTES=Add @DoNotMock to Traverser

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=321469875
  • Loading branch information
benyu authored and netdpb committed Jul 16, 2020
1 parent da93601 commit 6410f18
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Expand Up @@ -383,8 +383,8 @@ public void forGraph_depthFirstPreOrderIterable_javadocExample_canBeIteratedMult
@Test
public void forGraph_depthFirstPreOrder_infinite() {
Iterable<Integer> 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
Expand Down
4 changes: 4 additions & 0 deletions android/guava/src/com/google/common/graph/Traverser.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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<N> {
private final SuccessorsFunction<N> successorFunction;

Expand Down
4 changes: 2 additions & 2 deletions guava-tests/test/com/google/common/graph/TraverserTest.java
Expand Up @@ -383,8 +383,8 @@ public void forGraph_depthFirstPreOrderIterable_javadocExample_canBeIteratedMult
@Test
public void forGraph_depthFirstPreOrder_infinite() {
Iterable<Integer> 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
Expand Down
4 changes: 4 additions & 0 deletions guava/src/com/google/common/graph/Traverser.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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<N> {
private final SuccessorsFunction<N> successorFunction;

Expand Down

0 comments on commit 6410f18

Please sign in to comment.