Skip to content

Commit

Permalink
Migrate tests off Truth8.
Browse files Browse the repository at this point in the history
This is an internal loose end in #746.

RELNOTES=n/a
PiperOrigin-RevId: 611600975
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Feb 29, 2024
1 parent e3b4354 commit 213a156
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static com.google.common.truth.FailureAssertions.assertFailureKeys;
import static com.google.common.truth.FailureAssertions.assertFailureValue;
import static com.google.common.truth.IntStreamSubject.intStreams;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Arrays.asList;
import static org.junit.Assert.fail;

Expand All @@ -39,7 +40,7 @@ public final class IntStreamSubjectTest {
@SuppressWarnings("TruthSelfEquals")
public void testIsEqualTo() throws Exception {
IntStream stream = IntStream.of(42);
Truth8.assertThat(stream).isEqualTo(stream);
assertThat(stream).isEqualTo(stream);
}

@Test
Expand All @@ -53,7 +54,7 @@ public void testIsEqualToList() throws Exception {
public void testNullStream_fails() throws Exception {
IntStream nullStream = null;
try {
Truth8.assertThat(nullStream).isEmpty();
assertThat(nullStream).isEmpty();
fail();
} catch (NullPointerException expected) {
}
Expand All @@ -62,19 +63,19 @@ public void testNullStream_fails() throws Exception {
@Test
public void testNullStreamIsNull() throws Exception {
IntStream nullStream = null;
Truth8.assertThat(nullStream).isNull();
assertThat(nullStream).isNull();
}

@Test
@SuppressWarnings("TruthSelfEquals")
public void testIsSameInstanceAs() throws Exception {
IntStream stream = IntStream.of(1);
Truth8.assertThat(stream).isSameInstanceAs(stream);
assertThat(stream).isSameInstanceAs(stream);
}

@Test
public void testIsEmpty() throws Exception {
Truth8.assertThat(IntStream.of()).isEmpty();
assertThat(IntStream.of()).isEmpty();
}

@Test
Expand All @@ -85,7 +86,7 @@ public void testIsEmpty_fails() throws Exception {

@Test
public void testIsNotEmpty() throws Exception {
Truth8.assertThat(IntStream.of(42)).isNotEmpty();
assertThat(IntStream.of(42)).isNotEmpty();
}

@Test
Expand All @@ -96,7 +97,7 @@ public void testIsNotEmpty_fails() throws Exception {

@Test
public void testHasSize() throws Exception {
Truth8.assertThat(IntStream.of(42)).hasSize(1);
assertThat(IntStream.of(42)).hasSize(1);
}

@Test
Expand All @@ -107,7 +108,7 @@ public void testHasSize_fails() throws Exception {

@Test
public void testContainsNoDuplicates() throws Exception {
Truth8.assertThat(IntStream.of(42)).containsNoDuplicates();
assertThat(IntStream.of(42)).containsNoDuplicates();
}

@Test
Expand All @@ -118,7 +119,7 @@ public void testContainsNoDuplicates_fails() throws Exception {

@Test
public void testContains() throws Exception {
Truth8.assertThat(IntStream.of(42)).contains(42);
assertThat(IntStream.of(42)).contains(42);
}

@Test
Expand All @@ -129,7 +130,7 @@ public void testContains_fails() throws Exception {

@Test
public void testContainsAnyOf() throws Exception {
Truth8.assertThat(IntStream.of(42)).containsAnyOf(42, 43);
assertThat(IntStream.of(42)).containsAnyOf(42, 43);
}

@Test
Expand All @@ -140,7 +141,7 @@ public void testContainsAnyOf_fails() throws Exception {

@Test
public void testContainsAnyIn() throws Exception {
Truth8.assertThat(IntStream.of(42)).containsAnyIn(asList(42, 43));
assertThat(IntStream.of(42)).containsAnyIn(asList(42, 43));
}

@Test
Expand All @@ -152,7 +153,7 @@ public void testContainsAnyIn_fails() throws Exception {

@Test
public void testDoesNotContain() throws Exception {
Truth8.assertThat(IntStream.of(42)).doesNotContain(43);
assertThat(IntStream.of(42)).doesNotContain(43);
}

@Test
Expand All @@ -163,7 +164,7 @@ public void testDoesNotContain_fails() throws Exception {

@Test
public void testContainsNoneOf() throws Exception {
Truth8.assertThat(IntStream.of(42)).containsNoneOf(43, 44);
assertThat(IntStream.of(42)).containsNoneOf(43, 44);
}

@Test
Expand All @@ -174,7 +175,7 @@ public void testContainsNoneOf_fails() throws Exception {

@Test
public void testContainsNoneIn() throws Exception {
Truth8.assertThat(IntStream.of(42)).containsNoneIn(asList(43, 44));
assertThat(IntStream.of(42)).containsNoneIn(asList(43, 44));
}

@Test
Expand All @@ -186,7 +187,7 @@ public void testContainsNoneIn_fails() throws Exception {

@Test
public void testContainsAtLeast() throws Exception {
Truth8.assertThat(IntStream.of(42, 43)).containsAtLeast(42, 43);
assertThat(IntStream.of(42, 43)).containsAtLeast(42, 43);
}

@Test
Expand All @@ -198,7 +199,7 @@ public void testContainsAtLeast_fails() throws Exception {

@Test
public void testContainsAtLeast_inOrder() throws Exception {
Truth8.assertThat(IntStream.of(42, 43)).containsAtLeast(42, 43).inOrder();
assertThat(IntStream.of(42, 43)).containsAtLeast(42, 43).inOrder();
}

@Test
Expand All @@ -217,7 +218,7 @@ public void testContainsAtLeast_inOrder_fails() throws Exception {

@Test
public void testContainsAtLeastElementsIn() throws Exception {
Truth8.assertThat(IntStream.of(42, 43)).containsAtLeastElementsIn(asList(42, 43));
assertThat(IntStream.of(42, 43)).containsAtLeastElementsIn(asList(42, 43));
}

@Test
Expand All @@ -232,7 +233,7 @@ public void testContainsAtLeastElementsIn_fails() throws Exception {

@Test
public void testContainsAtLeastElementsIn_inOrder() throws Exception {
Truth8.assertThat(IntStream.of(42, 43)).containsAtLeastElementsIn(asList(42, 43)).inOrder();
assertThat(IntStream.of(42, 43)).containsAtLeastElementsIn(asList(42, 43)).inOrder();
}

@Test
Expand All @@ -254,7 +255,7 @@ public void testContainsAtLeastElementsIn_inOrder_fails() throws Exception {

@Test
public void testContainsExactly() throws Exception {
Truth8.assertThat(IntStream.of(42, 43)).containsExactly(42, 43);
assertThat(IntStream.of(42, 43)).containsExactly(42, 43);
}

@Test
Expand All @@ -267,7 +268,7 @@ public void testContainsExactly_fails() throws Exception {

@Test
public void testContainsExactly_inOrder() throws Exception {
Truth8.assertThat(IntStream.of(42, 43)).containsExactly(42, 43).inOrder();
assertThat(IntStream.of(42, 43)).containsExactly(42, 43).inOrder();
}

@Test
Expand All @@ -282,8 +283,8 @@ public void testContainsExactly_inOrder_fails() throws Exception {

@Test
public void testContainsExactlyElementsIn() throws Exception {
Truth8.assertThat(IntStream.of(42, 43)).containsExactlyElementsIn(asList(42, 43));
Truth8.assertThat(IntStream.of(42, 43)).containsExactlyElementsIn(asList(43, 42));
assertThat(IntStream.of(42, 43)).containsExactlyElementsIn(asList(42, 43));
assertThat(IntStream.of(42, 43)).containsExactlyElementsIn(asList(43, 42));
}

@Test
Expand All @@ -298,7 +299,7 @@ public void testContainsExactlyElementsIn_fails() throws Exception {

@Test
public void testContainsExactlyElementsIn_inOrder() throws Exception {
Truth8.assertThat(IntStream.of(42, 43)).containsExactlyElementsIn(asList(42, 43)).inOrder();
assertThat(IntStream.of(42, 43)).containsExactlyElementsIn(asList(42, 43)).inOrder();
}

@Test
Expand All @@ -316,14 +317,14 @@ public void testContainsExactlyElementsIn_inOrder_fails() throws Exception {

@Test
public void testContainsExactlyElementsIn_inOrder_intStream() throws Exception {
Truth8.assertThat(IntStream.of(1, 2, 3, 4)).containsExactly(1, 2, 3, 4).inOrder();
assertThat(IntStream.of(1, 2, 3, 4)).containsExactly(1, 2, 3, 4).inOrder();
}

@Test
public void testIsInOrder() {
Truth8.assertThat(IntStream.of()).isInOrder();
Truth8.assertThat(IntStream.of(1)).isInOrder();
Truth8.assertThat(IntStream.of(1, 1, 2, 3, 3, 3, 4)).isInOrder();
assertThat(IntStream.of()).isInOrder();
assertThat(IntStream.of(1)).isInOrder();
assertThat(IntStream.of(1, 1, 2, 3, 3, 3, 4)).isInOrder();
}

@Test
Expand All @@ -334,9 +335,9 @@ public void testIsInOrder_fails() {

@Test
public void testIsInStrictOrder() {
Truth8.assertThat(IntStream.of()).isInStrictOrder();
Truth8.assertThat(IntStream.of(1)).isInStrictOrder();
Truth8.assertThat(IntStream.of(1, 2, 3, 4)).isInStrictOrder();
assertThat(IntStream.of()).isInStrictOrder();
assertThat(IntStream.of(1)).isInStrictOrder();
assertThat(IntStream.of(1, 2, 3, 4)).isInStrictOrder();
}

@Test
Expand Down
Loading

0 comments on commit 213a156

Please sign in to comment.