Skip to content

Commit

Permalink
Automated Code Change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 603080567
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Jan 31, 2024
1 parent da9bc28 commit a9d243c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
18 changes: 4 additions & 14 deletions guava-tests/test/com/google/common/collect/FluentIterableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.google.common.collect;

import static com.google.common.collect.FluentIterableTest.Help.assertThat;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Arrays.asList;
Expand All @@ -31,8 +30,7 @@
import com.google.common.collect.testing.IteratorFeature;
import com.google.common.collect.testing.IteratorTester;
import com.google.common.testing.NullPointerTester;
import com.google.common.truth.IterableSubject;
import com.google.common.truth.Truth;
import com.google.common.truth.Truth8;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand All @@ -41,7 +39,6 @@
import java.util.Set;
import java.util.SortedSet;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.checkerframework.checker.nullness.qual.Nullable;
Expand Down Expand Up @@ -926,16 +923,9 @@ public void testGet_outOfBounds() {
* just test that the toArray() contents are as expected.
*/
public void testStream() {
assertThat(FluentIterable.of().stream()).isEmpty();
assertThat(FluentIterable.of("a").stream()).containsExactly("a");
assertThat(FluentIterable.of(1, 2, 3).stream().filter(n -> n > 1)).containsExactly(2, 3);
}

// TODO(kevinb): add assertThat(Stream) to Truth?
static class Help {
static IterableSubject assertThat(Stream<?> stream) {
return Truth.assertThat(stream.toArray()).asList();
}
Truth8.assertThat(FluentIterable.of().stream()).isEmpty();
Truth8.assertThat(FluentIterable.of("a").stream()).containsExactly("a");
Truth8.assertThat(FluentIterable.of(1, 2, 3).stream().filter(n -> n > 1)).containsExactly(2, 3);
}

private static void assertCanIterateAgain(Iterable<?> iterable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
package com.google.common.collect;

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

import com.google.common.annotations.GwtCompatible;
import com.google.common.truth.Truth8;
import java.util.NoSuchElementException;
import java.util.stream.Stream;
import junit.framework.TestCase;
Expand All @@ -32,11 +32,11 @@
@GwtCompatible
public class MoreCollectorsTest extends TestCase {
public void testToOptionalEmpty() {
assertThat(Stream.empty().collect(MoreCollectors.toOptional())).isEmpty();
Truth8.assertThat(Stream.empty().collect(MoreCollectors.toOptional())).isEmpty();
}

public void testToOptionalSingleton() {
assertThat(Stream.of(1).collect(MoreCollectors.toOptional())).hasValue(1);
Truth8.assertThat(Stream.of(1).collect(MoreCollectors.toOptional())).hasValue(1);
}

public void testToOptionalNull() {
Expand Down
10 changes: 5 additions & 5 deletions guava-tests/test/com/google/common/graph/ValueGraphTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
import static com.google.common.graph.GraphConstants.ENDPOINTS_MISMATCH;
import static com.google.common.graph.TestUtil.assertStronglyEquivalent;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static java.util.concurrent.Executors.newFixedThreadPool;
import static org.junit.Assert.assertThrows;

import com.google.common.collect.ImmutableList;
import com.google.common.truth.Truth8;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.CyclicBarrier;
Expand Down Expand Up @@ -183,14 +183,14 @@ public void hasEdgeConnecting_undirected_mismatch() {
public void edgeValue_directed_correct() {
graph = ValueGraphBuilder.directed().build();
graph.putEdgeValue(1, 2, "A");
assertThat(graph.edgeValue(EndpointPair.ordered(1, 2))).hasValue("A");
Truth8.assertThat(graph.edgeValue(EndpointPair.ordered(1, 2))).hasValue("A");
}

@Test
public void edgeValue_directed_backwards() {
graph = ValueGraphBuilder.directed().build();
graph.putEdgeValue(1, 2, "A");
assertThat(graph.edgeValue(EndpointPair.ordered(2, 1))).isEmpty();
Truth8.assertThat(graph.edgeValue(EndpointPair.ordered(2, 1))).isEmpty();
}

@Test
Expand All @@ -211,14 +211,14 @@ public void edgeValue_directed_mismatch() {
public void edgeValue_undirected_correct() {
graph = ValueGraphBuilder.undirected().build();
graph.putEdgeValue(1, 2, "A");
assertThat(graph.edgeValue(EndpointPair.unordered(1, 2))).hasValue("A");
Truth8.assertThat(graph.edgeValue(EndpointPair.unordered(1, 2))).hasValue("A");
}

@Test
public void edgeValue_undirected_backwards() {
graph = ValueGraphBuilder.undirected().build();
graph.putEdgeValue(1, 2, "A");
assertThat(graph.edgeValue(EndpointPair.unordered(2, 1))).hasValue("A");
Truth8.assertThat(graph.edgeValue(EndpointPair.unordered(2, 1))).hasValue("A");
}

@Test
Expand Down

0 comments on commit a9d243c

Please sign in to comment.