diff options
author | Paul Duffin <paulduffin@google.com> | 2015-05-29 15:33:20 +0100 |
---|---|---|
committer | Paul Duffin <paulduffin@google.com> | 2015-06-11 12:37:00 +0100 |
commit | 3ecfa412eddc4b084663f38d562537b86b9734d5 (patch) | |
tree | fcdd6fcea5843db15e5afa87883979c2f32139ba /guava-gwt | |
parent | 6a5ff04444ec0ece7d92e418867d8c222c825535 (diff) | |
download | guava-3ecfa412eddc4b084663f38d562537b86b9734d5.tar.gz |
Upgraded Guava to unmodified v18.0
This simply copies the Guava source for v18.0 straight from the
github repository into this one.
See https://github.com/google/guava.git
Additional commits will be made which will allow this to compile
on Android.
BUG=19672715
Change-Id: Ief2c7a00b4456aa03ce3ca73db34cb86abdbad14
Diffstat (limited to 'guava-gwt')
83 files changed, 888 insertions, 756 deletions
diff --git a/guava-gwt/pom.xml b/guava-gwt/pom.xml index 065909a9c..f98a73158 100644 --- a/guava-gwt/pom.xml +++ b/guava-gwt/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>com.google.guava</groupId> <artifactId>guava-parent</artifactId> - <version>17.0-SNAPSHOT</version> + <version>18.0</version> </parent> <artifactId>guava-gwt</artifactId> <name>Guava GWT compatible libs</name> @@ -17,7 +17,8 @@ This project includes GWT-friendly sources. </description> <properties> - <gwt.version>2.5.0-rc1</gwt.version> + <gwt.test.include>**/GwtTestSuite.java</gwt.test.include> + <gwt.version>2.6.1</gwt.version> </properties> <dependencies> <!-- GWT requires a library's transitive dependencies to be present when @@ -66,7 +67,7 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>org.truth0</groupId> + <groupId>com.google.truth</groupId> <artifactId>truth</artifactId> <version>${truth.version}</version> <classifier>gwt</classifier> @@ -240,7 +241,7 @@ <configuration> <module>com.google.common.GuavaTests</module> <strict>true</strict> - <includes>**/GwtTestSuite.java</includes> + <includes>${gwt.test.include}</includes> <mode>htmlunit</mode> <testTimeOut>600</testTimeOut> <extraJvmArgs>-Xms3500m -Xmx3500m -Xss1024k</extraJvmArgs> diff --git a/guava-gwt/src-super/com/google/common/base/super/com/google/common/base/Charsets.java b/guava-gwt/src-super/com/google/common/base/super/com/google/common/base/Charsets.java index 27e6bf588..10d83ce5b 100644 --- a/guava-gwt/src-super/com/google/common/base/super/com/google/common/base/Charsets.java +++ b/guava-gwt/src-super/com/google/common/base/super/com/google/common/base/Charsets.java @@ -40,6 +40,9 @@ public final class Charsets { /** * UTF-8: eight-bit UCS Transformation Format. * + * <p><b>Note for Java 7 and later:</b> this constant should be treated as deprecated; use + * {@link java.nio.charset.StandardCharsets#UTF_8} instead. + * */ public static final Charset UTF_8 = Charset.forName("UTF-8"); diff --git a/guava-gwt/src-super/com/google/common/base/super/com/google/common/base/Enums.java b/guava-gwt/src-super/com/google/common/base/super/com/google/common/base/Enums.java index 4927e21e3..f4aa4a8a2 100644 --- a/guava-gwt/src-super/com/google/common/base/super/com/google/common/base/Enums.java +++ b/guava-gwt/src-super/com/google/common/base/super/com/google/common/base/Enums.java @@ -39,61 +39,6 @@ public final class Enums { private Enums() {} /** - * Returns a {@link Function} that maps an {@link Enum} name to the associated {@code Enum} - * constant. The {@code Function} will return {@code null} if the {@code Enum} constant - * does not exist. - * - * @param enumClass the {@link Class} of the {@code Enum} declaring the constant values - * @deprecated Use {@link Enums#stringConverter} instead. Note that the string converter has - * slightly different behavior: it throws {@link IllegalArgumentException} if the enum - * constant does not exist rather than returning {@code null}. It also converts {@code null} - * to {@code null} rather than throwing {@link NullPointerException}. This method is - * scheduled for removal in Guava 18.0. - */ - @Deprecated - public static <T extends Enum<T>> Function<String, T> valueOfFunction( - Class<T> enumClass) { - return new ValueOfFunction<T>(enumClass); - } - - /** - * A {@link Function} that maps an {@link Enum} name to the associated constant, or {@code null} - * if the constant does not exist. - */ - private static final class ValueOfFunction<T extends Enum<T>> - implements Function<String, T>, Serializable { - - private final Class<T> enumClass; - - private ValueOfFunction(Class<T> enumClass) { - this.enumClass = checkNotNull(enumClass); - } - - @Override - public T apply(String value) { - try { - return Enum.valueOf(enumClass, value); - } catch (IllegalArgumentException e) { - return null; - } - } - - @Override public boolean equals(@Nullable Object obj) { - return obj instanceof ValueOfFunction && enumClass.equals(((ValueOfFunction) obj).enumClass); - } - - @Override public int hashCode() { - return enumClass.hashCode(); - } - - @Override public String toString() { - return "Enums.valueOf(" + enumClass + ")"; - } - - private static final long serialVersionUID = 0; - } - - /** * Returns an optional enum constant for the given type, using {@link Enum#valueOf}. If the * constant does not exist, {@link Optional#absent} is returned. A common use case is for parsing * user input or falling back to a default enum constant. For example, @@ -161,3 +106,4 @@ public final class Enums { private static final long serialVersionUID = 0L; } } + diff --git a/guava-gwt/src-super/com/google/common/cache/super/com/google/common/cache/CacheBuilder.java b/guava-gwt/src-super/com/google/common/cache/super/com/google/common/cache/CacheBuilder.java index 40753bef2..8e50152db 100644 --- a/guava-gwt/src-super/com/google/common/cache/super/com/google/common/cache/CacheBuilder.java +++ b/guava-gwt/src-super/com/google/common/cache/super/com/google/common/cache/CacheBuilder.java @@ -16,7 +16,6 @@ package com.google.common.cache; -import static com.google.common.base.Objects.firstNonNull; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; @@ -24,7 +23,7 @@ import static com.google.common.base.Preconditions.checkState; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Ascii; import com.google.common.base.Equivalence; -import com.google.common.base.Objects; +import com.google.common.base.MoreObjects; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import com.google.common.base.Ticker; @@ -244,11 +243,11 @@ public final class CacheBuilder<K, V> { } Equivalence<Object> getKeyEquivalence() { - return firstNonNull(keyEquivalence, getKeyStrength().defaultEquivalence()); + return MoreObjects.firstNonNull(keyEquivalence, getKeyStrength().defaultEquivalence()); } Equivalence<Object> getValueEquivalence() { - return firstNonNull(valueEquivalence, getValueStrength().defaultEquivalence()); + return MoreObjects.firstNonNull(valueEquivalence, getValueStrength().defaultEquivalence()); } /** @@ -351,7 +350,7 @@ public final class CacheBuilder<K, V> { // Make a safe contravariant cast now so we don't have to do it over and over. @SuppressWarnings("unchecked") <K1 extends K, V1 extends V> Weigher<K1, V1> getWeigher() { - return (Weigher<K1, V1>) Objects.firstNonNull(weigher, OneWeigher.INSTANCE); + return (Weigher<K1, V1>) MoreObjects.firstNonNull(weigher, OneWeigher.INSTANCE); } CacheBuilder<K, V> setKeyStrength(Strength strength) { @@ -361,7 +360,7 @@ public final class CacheBuilder<K, V> { } Strength getKeyStrength() { - return firstNonNull(keyStrength, Strength.STRONG); + return MoreObjects.firstNonNull(keyStrength, Strength.STRONG); } CacheBuilder<K, V> setValueStrength(Strength strength) { @@ -371,7 +370,7 @@ public final class CacheBuilder<K, V> { } Strength getValueStrength() { - return firstNonNull(valueStrength, Strength.STRONG); + return MoreObjects.firstNonNull(valueStrength, Strength.STRONG); } /** @@ -502,7 +501,8 @@ public final class CacheBuilder<K, V> { // Make a safe contravariant cast now so we don't have to do it over and over. @SuppressWarnings("unchecked") <K1 extends K, V1 extends V> RemovalListener<K1, V1> getRemovalListener() { - return (RemovalListener<K1, V1>) Objects.firstNonNull(removalListener, NullListener.INSTANCE); + return (RemovalListener<K1, V1>) + MoreObjects.firstNonNull(removalListener, NullListener.INSTANCE); } /** @@ -586,7 +586,7 @@ public final class CacheBuilder<K, V> { */ @Override public String toString() { - Objects.ToStringHelper s = Objects.toStringHelper(this); + MoreObjects.ToStringHelper s = MoreObjects.toStringHelper(this); if (initialCapacity != UNSET_INT) { s.add("initialCapacity", initialCapacity); } diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/FluentIterable.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/FluentIterable.java index 42ae48640..641b052b7 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/FluentIterable.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/FluentIterable.java @@ -21,9 +21,11 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Function; +import com.google.common.base.Joiner; import com.google.common.base.Optional; import com.google.common.base.Predicate; +import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.Iterator; @@ -109,6 +111,16 @@ public abstract class FluentIterable<E> implements Iterable<E> { } /** + * Returns a fluent iterable containing {@code elements} in the specified order. + * + * @since 18.0 + */ + @Beta + public static <E> FluentIterable<E> of(E[] elements) { + return from(Lists.newArrayList(elements)); + } + + /** * Returns a string representation of this fluent iterable, with the format * {@code [e1, e2, ..., en]}. */ @@ -151,6 +163,33 @@ public abstract class FluentIterable<E> implements Iterable<E> { } /** + * Returns a fluent iterable whose iterators traverse first the elements of this fluent iterable, + * followed by those of {@code other}. The iterators are not polled until necessary. + * + * <p>The returned iterable's {@code Iterator} supports {@code remove()} when the corresponding + * {@code Iterator} supports it. + * + * @since 18.0 + */ + @Beta + @CheckReturnValue + public final FluentIterable<E> append(Iterable<? extends E> other) { + return from(Iterables.concat(iterable, other)); + } + + /** + * Returns a fluent iterable whose iterators traverse first the elements of this fluent iterable, + * followed by {@code elements}. + * + * @since 18.0 + */ + @Beta + @CheckReturnValue + public final FluentIterable<E> append(E... elements) { + return from(Iterables.concat(iterable, Arrays.asList(elements))); + } + + /** * Returns the elements from this fluent iterable that satisfy a predicate. The * resulting fluent iterable's iterator does not support {@code remove()}. */ @@ -331,7 +370,6 @@ public abstract class FluentIterable<E> implements Iterable<E> { * @throws NullPointerException if any element is null * @since 14.0 (since 13.0 as {@code toSortedImmutableList()}). */ - @Beta public final ImmutableList<E> toSortedList(Comparator<? super E> comparator) { return Ordering.from(comparator).immutableSortedCopy(iterable); } @@ -433,6 +471,17 @@ public abstract class FluentIterable<E> implements Iterable<E> { } /** + * Returns a {@link String} containing all of the elements of this fluent iterable joined with + * {@code joiner}. + * + * @since 18.0 + */ + @Beta + public final String join(Joiner joiner) { + return joiner.join(this); + } + + /** * Returns the element at the specified position in this fluent iterable. * * @param position position of the element to return diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableCollection.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableCollection.java index 0a5a8047b..d32c8345c 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableCollection.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableCollection.java @@ -95,7 +95,12 @@ public abstract class ImmutableCollection<E> extends AbstractCollection<E> return false; } - abstract static class Builder<E> { + /** + * GWT emulated version of {@link ImmutableCollection.Builder}. + */ + public abstract static class Builder<E> { + + Builder() {} public abstract Builder<E> add(E element); diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSetMultimap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSetMultimap.java index fca8b2c1a..1a4b3928c 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSetMultimap.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSetMultimap.java @@ -16,10 +16,10 @@ package com.google.common.collect; -import static com.google.common.base.Objects.firstNonNull; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.annotations.GwtCompatible; +import com.google.common.base.MoreObjects; import java.util.Arrays; import java.util.Collection; @@ -351,7 +351,7 @@ public class ImmutableSetMultimap<K, V> @Override public ImmutableSet<V> get(@Nullable K key) { // This cast is safe as its type is known in constructor. ImmutableSet<V> set = (ImmutableSet<V>) map.get(key); - return firstNonNull(set, emptySet); + return MoreObjects.firstNonNull(set, emptySet); } private transient ImmutableSetMultimap<V, K> inverse; diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Iterators.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Iterators.java index 15b1de094..e63a46065 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Iterators.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Iterators.java @@ -100,7 +100,12 @@ public final class Iterators { * * <p>The {@link Iterable} equivalent of this method is {@link * ImmutableSet#of()}. + * + * @deprecated Use {@code ImmutableSet.<T>of().iterator()} instead; or for + * Java 7 or later, {@link Collections#emptyIterator}. This method is + * scheduled for removal in May 2016. */ + @Deprecated public static <T> UnmodifiableIterator<T> emptyIterator() { return emptyListIterator(); } diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Lists.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Lists.java index a817fd4f8..74e9606d2 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Lists.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Lists.java @@ -70,12 +70,16 @@ public final class Lists { // ArrayList /** - * Creates a <i>mutable</i>, empty {@code ArrayList} instance. + * Creates a <i>mutable</i>, empty {@code ArrayList} instance (for Java 6 and + * earlier). * * <p><b>Note:</b> if mutability is not required, use {@link * ImmutableList#of()} instead. * - * @return a new, empty {@code ArrayList} + * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and + * should be treated as deprecated. Instead, use the {@code ArrayList} + * {@linkplain ArrayList#ArrayList() constructor} directly, taking advantage + * of the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. */ @GwtCompatible(serializable = true) public static <E> ArrayList<E> newArrayList() { @@ -86,12 +90,18 @@ public final class Lists { * Creates a <i>mutable</i> {@code ArrayList} instance containing the given * elements. * - * <p><b>Note:</b> if mutability is not required and the elements are - * non-null, use an overload of {@link ImmutableList#of()} (for varargs) or - * {@link ImmutableList#copyOf(Object[])} (for an array) instead. + * <p><b>Note:</b> essentially the only reason to use this method is when you + * will need to add or remove elements later. Otherwise, for non-null elements + * use {@link ImmutableList#of()} (for varargs) or {@link + * ImmutableList#copyOf(Object[])} (for an array) instead. If any elements + * might be null, or you need support for {@link List#set(int, Object)}, use + * {@link Arrays#asList}. * - * @param elements the elements that the list should contain, in order - * @return a new {@code ArrayList} containing those elements + * <p>Note that even when you do need the ability to add or remove, this method + * provides only a tiny bit of syntactic sugar for {@code newArrayList(}{@link + * Arrays#asList asList}{@code (...))}, or for creating an empty list then + * calling {@link Collections#addAll}. This method is not actually very useful + * and will likely be deprecated in the future. */ @GwtCompatible(serializable = true) public static <E> ArrayList<E> newArrayList(E... elements) { @@ -112,13 +122,18 @@ public final class Lists { /** * Creates a <i>mutable</i> {@code ArrayList} instance containing the given - * elements. + * elements; a very thin shortcut for creating an empty list then calling + * {@link Iterables#addAll}. * * <p><b>Note:</b> if mutability is not required and the elements are - * non-null, use {@link ImmutableList#copyOf(Iterator)} instead. + * non-null, use {@link ImmutableList#copyOf(Iterable)} instead. (Or, change + * {@code elements} to be a {@link FluentIterable} and call + * {@code elements.toList()}.) * - * @param elements the elements that the list should contain, in order - * @return a new {@code ArrayList} containing those elements + * <p><b>Note for Java 7 and later:</b> if {@code elements} is a {@link + * Collection}, you don't need this method. Use the {@code ArrayList} + * {@linkplain ArrayList#ArrayList(Collection) constructor} directly, taking + * advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. */ @GwtCompatible(serializable = true) public static <E> ArrayList<E> newArrayList(Iterable<? extends E> elements) { @@ -131,13 +146,11 @@ public final class Lists { /** * Creates a <i>mutable</i> {@code ArrayList} instance containing the given - * elements. + * elements; a very thin shortcut for creating an empty list and then calling + * {@link Iterators#addAll}. * * <p><b>Note:</b> if mutability is not required and the elements are * non-null, use {@link ImmutableList#copyOf(Iterator)} instead. - * - * @param elements the elements that the list should contain, in order - * @return a new {@code ArrayList} containing those elements */ @GwtCompatible(serializable = true) public static <E> ArrayList<E> newArrayList(Iterator<? extends E> elements) { @@ -147,17 +160,15 @@ public final class Lists { } /** - * Creates an {@code ArrayList} instance backed by an array of the - * <i>exact</i> size specified; equivalent to - * {@link ArrayList#ArrayList(int)}. - * - * <p><b>Note:</b> if you know the exact size your list will be, consider - * using a fixed-size list ({@link Arrays#asList(Object[])}) or an {@link - * ImmutableList} instead of a growable {@link ArrayList}. + * Creates an {@code ArrayList} instance backed by an array with the specified + * initial size; simply delegates to {@link ArrayList#ArrayList(int)}. * - * <p><b>Note:</b> If you have only an <i>estimate</i> of the eventual size of - * the list, consider padding this estimate by a suitable amount, or simply - * use {@link #newArrayListWithExpectedSize(int)} instead. + * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and + * should be treated as deprecated. Instead, use {@code new }{@link + * ArrayList#ArrayList(int) ArrayList}{@code <>(int)} directly, taking + * advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * (Unlike here, there is no risk of overload ambiguity, since the {@code + * ArrayList} constructors very wisely did not accept varargs.) * * @param initialArraySize the exact size of the initial backing array for * the returned array list ({@code ArrayList} documentation calls this @@ -174,13 +185,14 @@ public final class Lists { } /** - * Creates an {@code ArrayList} instance sized appropriately to hold an - * <i>estimated</i> number of elements without resizing. A small amount of - * padding is added in case the estimate is low. + * Creates an {@code ArrayList} instance to hold {@code estimatedSize} + * elements, <i>plus</i> an unspecified amount of padding; you almost + * certainly mean to call {@link #newArrayListWithCapacity} (see that method + * for further advice on usage). * - * <p><b>Note:</b> If you know the <i>exact</i> number of elements the list - * will hold, or prefer to calculate your own amount of padding, refer to - * {@link #newArrayListWithCapacity(int)}. + * <p><b>Note:</b> This method will soon be deprecated. Even in the rare case + * that you do want some amount of padding, it's best if you choose your + * desired amount explicitly. * * @param estimatedSize an estimate of the eventual {@link List#size()} of * the new list @@ -197,12 +209,21 @@ public final class Lists { // LinkedList /** - * Creates an empty {@code LinkedList} instance. + * Creates a <i>mutable</i>, empty {@code LinkedList} instance (for Java 6 and + * earlier). * - * <p><b>Note:</b> if you need an immutable empty {@link List}, use - * {@link ImmutableList#of()} instead. + * <p><b>Note:</b> if you won't be adding any elements to the list, use {@link + * ImmutableList#of()} instead. + * + * <p><b>Performance note:</b> {@link ArrayList} and {@link + * java.util.ArrayDeque} consistently outperform {@code LinkedList} except in + * certain rare and specific situations. Unless you have spent a lot of time + * benchmarking your specific needs, use one of those instead. * - * @return a new, empty {@code LinkedList} + * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and + * should be treated as deprecated. Instead, use the {@code LinkedList} + * {@linkplain LinkedList#LinkedList() constructor} directly, taking advantage + * of the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. */ @GwtCompatible(serializable = true) public static <E> LinkedList<E> newLinkedList() { @@ -210,10 +231,24 @@ public final class Lists { } /** - * Creates a {@code LinkedList} instance containing the given elements. + * Creates a <i>mutable</i> {@code LinkedList} instance containing the given + * elements; a very thin shortcut for creating an empty list then calling + * {@link Iterables#addAll}. + * + * <p><b>Note:</b> if mutability is not required and the elements are + * non-null, use {@link ImmutableList#copyOf(Iterable)} instead. (Or, change + * {@code elements} to be a {@link FluentIterable} and call + * {@code elements.toList()}.) + * + * <p><b>Performance note:</b> {@link ArrayList} and {@link + * java.util.ArrayDeque} consistently outperform {@code LinkedList} except in + * certain rare and specific situations. Unless you have spent a lot of time + * benchmarking your specific needs, use one of those instead. * - * @param elements the elements that the list should contain, in order - * @return a new {@code LinkedList} containing those elements + * <p><b>Note for Java 7 and later:</b> if {@code elements} is a {@link + * Collection}, you don't need this method. Use the {@code LinkedList} + * {@linkplain LinkedList#LinkedList(Collection) constructor} directly, taking + * advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. */ @GwtCompatible(serializable = true) public static <E> LinkedList<E> newLinkedList( diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Maps.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Maps.java index 01a0741f1..f5d84ae60 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Maps.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Maps.java @@ -654,7 +654,7 @@ public final class Maps { * Removal operations write through to the backing set. The returned map * does not support put operations. * - * <p><b>Warning</b>: If the function rejects {@code null}, caution is + * <p><b>Warning:</b> If the function rejects {@code null}, caution is * required to make sure the set does not contain {@code null}, because the * view cannot stop {@code null} from being added to the set. * @@ -690,7 +690,7 @@ public final class Maps { * Removal operations write through to the backing set. The returned map does * not support put operations. * - * <p><b>Warning</b>: If the function rejects {@code null}, caution is + * <p><b>Warning:</b> If the function rejects {@code null}, caution is * required to make sure the set does not contain {@code null}, because the * view cannot stop {@code null} from being added to the set. * diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/TreeMultiset.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/TreeMultiset.java index 3f6aab2e3..b9be3d38c 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/TreeMultiset.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/TreeMultiset.java @@ -22,7 +22,7 @@ import static com.google.common.collect.CollectPreconditions.checkNonnegative; import static com.google.common.collect.CollectPreconditions.checkRemove; import com.google.common.annotations.GwtCompatible; -import com.google.common.base.Objects; +import com.google.common.base.MoreObjects; import com.google.common.primitives.Ints; import java.io.Serializable; @@ -895,7 +895,7 @@ public final class TreeMultiset<E> extends AbstractSortedMultiset<E> implements @Nullable private AvlNode<E> ceiling(Comparator<? super E> comparator, E e) { int cmp = comparator.compare(e, elem); if (cmp < 0) { - return (left == null) ? this : Objects.firstNonNull(left.ceiling(comparator, e), this); + return (left == null) ? this : MoreObjects.firstNonNull(left.ceiling(comparator, e), this); } else if (cmp == 0) { return this; } else { @@ -906,7 +906,7 @@ public final class TreeMultiset<E> extends AbstractSortedMultiset<E> implements @Nullable private AvlNode<E> floor(Comparator<? super E> comparator, E e) { int cmp = comparator.compare(e, elem); if (cmp > 0) { - return (right == null) ? this : Objects.firstNonNull(right.floor(comparator, e), this); + return (right == null) ? this : MoreObjects.firstNonNull(right.floor(comparator, e), this); } else if (cmp == 0) { return this; } else { diff --git a/guava-gwt/src-super/com/google/common/math/super/com/google/common/math/BigIntegerMath.java b/guava-gwt/src-super/com/google/common/math/super/com/google/common/math/BigIntegerMath.java index 75f19be9e..b81f76d8a 100644 --- a/guava-gwt/src-super/com/google/common/math/super/com/google/common/math/BigIntegerMath.java +++ b/guava-gwt/src-super/com/google/common/math/super/com/google/common/math/BigIntegerMath.java @@ -122,7 +122,7 @@ public final class BigIntegerMath { * Returns {@code n!}, that is, the product of the first {@code n} positive * integers, or {@code 1} if {@code n == 0}. * - * <p><b>Warning</b>: the result takes <i>O(n log n)</i> space, so use cautiously. + * <p><b>Warning:</b> the result takes <i>O(n log n)</i> space, so use cautiously. * * <p>This uses an efficient binary recursive algorithm to compute the factorial * with balanced multiplies. It also removes all the 2s from the intermediate @@ -210,7 +210,7 @@ public final class BigIntegerMath { * Returns {@code n} choose {@code k}, also known as the binomial coefficient of {@code n} and * {@code k}, that is, {@code n! / (k! (n - k)!)}. * - * <p><b>Warning</b>: the result can take as much as <i>O(k log n)</i> space. + * <p><b>Warning:</b> the result can take as much as <i>O(k log n)</i> space. * * @throws IllegalArgumentException if {@code n < 0}, {@code k < 0}, or {@code k > n} */ diff --git a/guava-gwt/src-super/com/google/common/math/super/com/google/common/math/DoubleMath.java b/guava-gwt/src-super/com/google/common/math/super/com/google/common/math/DoubleMath.java index 9bffdff23..25743223b 100644 --- a/guava-gwt/src-super/com/google/common/math/super/com/google/common/math/DoubleMath.java +++ b/guava-gwt/src-super/com/google/common/math/super/com/google/common/math/DoubleMath.java @@ -69,7 +69,7 @@ public final class DoubleMath { /** * Returns {@code n!}, that is, the product of the first {@code n} positive - * integers, {@code 1} if {@code n == 0}, or e n!}, or + * integers, {@code 1} if {@code n == 0}, or {@code n!}, or * {@link Double#POSITIVE_INFINITY} if {@code n! > Double.MAX_VALUE}. * * <p>The result is within 1 ulp of the true value. diff --git a/guava-gwt/src-super/com/google/common/math/super/com/google/common/math/LongMath.java b/guava-gwt/src-super/com/google/common/math/super/com/google/common/math/LongMath.java index 1a5be4ffd..a210627cf 100644 --- a/guava-gwt/src-super/com/google/common/math/super/com/google/common/math/LongMath.java +++ b/guava-gwt/src-super/com/google/common/math/super/com/google/common/math/LongMath.java @@ -56,7 +56,7 @@ public final class LongMath { public static boolean isPowerOfTwo(long x) { return x > 0 & (x & (x - 1)) == 0; } - + /** * Returns 1 if {@code x < y} as unsigned longs, and 0 otherwise. Assumes that x - y fits into a * signed long. The implementation is branch-free, and benchmarks suggest it is measurably @@ -227,14 +227,14 @@ public final class LongMath { return result; } else { int nBits = LongMath.log2(n, RoundingMode.CEILING); - + long result = 1; long numerator = n--; long denominator = 1; - + int numeratorBits = nBits; // This is an upper bound on log2(numerator, ceiling). - + /* * We want to do this in long math for speed, but want to avoid overflow. We adapt the * technique previously used by BigIntegerMath: maintain separate numerator and @@ -259,7 +259,7 @@ public final class LongMath { } } } - + /** * Returns (x * numerator / denominator), which is assumed to come out to an integral value. */ @@ -314,4 +314,3 @@ public final class LongMath { private LongMath() {} } - diff --git a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Chars.java b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Chars.java index b4e00cff1..c16737399 100644 --- a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Chars.java +++ b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Chars.java @@ -105,8 +105,8 @@ public final class Chars { * Compares the two specified {@code char} values. The sign of the value * returned is the same as that of {@code ((Character) a).compareTo(b)}. * - * <p><b>Note:</b> projects using JDK 7 or later should use the equivalent - * {@link Character#compare} method instead. + * <p><b>Note for Java 7 and later:</b> this method should be treated as + * deprecated; use the equivalent {@link Character#compare} method instead. * * @param a the first {@code char} to compare * @param b the second {@code char} to compare diff --git a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Doubles.java b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Doubles.java index 9161389cc..0b7bb636c 100644 --- a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Doubles.java +++ b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Doubles.java @@ -387,7 +387,7 @@ public final class Doubles { public int compare(double[] left, double[] right) { int minLength = Math.min(left.length, right.length); for (int i = 0; i < minLength; i++) { - int result = Doubles.compare(left[i], right[i]); + int result = Double.compare(left[i], right[i]); if (result != 0) { return result; } diff --git a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Floats.java b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Floats.java index 3743d116f..d669e5041 100644 --- a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Floats.java +++ b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Floats.java @@ -384,7 +384,7 @@ public final class Floats { public int compare(float[] left, float[] right) { int minLength = Math.min(left.length, right.length); for (int i = 0; i < minLength; i++) { - int result = Floats.compare(left[i], right[i]); + int result = Float.compare(left[i], right[i]); if (result != 0) { return result; } diff --git a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Ints.java b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Ints.java index d924d09a7..eb14ea550 100644 --- a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Ints.java +++ b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Ints.java @@ -34,6 +34,8 @@ import java.util.Comparator; import java.util.List; import java.util.RandomAccess; +import javax.annotation.CheckForNull; + /** * Static utility methods pertaining to {@code int} primitives, that are not * already found in either {@link Integer} or {@link Arrays}. @@ -112,8 +114,8 @@ public final class Ints { * Compares the two specified {@code int} values. The sign of the value * returned is the same as that of {@code ((Integer) a).compareTo(b)}. * - * <p><b>Note:</b> projects using JDK 7 or later should use the equivalent - * {@link Integer#compare} method instead. + * <p><b>Note for Java 7 and later:</b> this method should be treated as + * deprecated; use the equivalent {@link Integer#compare} method instead. * * @param a the first {@code int} to compare * @param b the second {@code int} to compare @@ -598,4 +600,95 @@ public final class Ints { private static int digit(char c) { return (c < 128) ? asciiDigits[c] : -1; } + + /** + * Parses the specified string as a signed decimal integer value. The ASCII + * character {@code '-'} (<code>'\u002D'</code>) is recognized as the + * minus sign. + * + * <p>Unlike {@link Integer#parseInt(String)}, this method returns + * {@code null} instead of throwing an exception if parsing fails. + * Additionally, this method only accepts ASCII digits, and returns + * {@code null} if non-ASCII digits are present in the string. + * + * <p>Note that strings prefixed with ASCII {@code '+'} are rejected, even + * under JDK 7, despite the change to {@link Integer#parseInt(String)} for + * that version. + * + * @param string the string representation of an integer value + * @return the integer value represented by {@code string}, or {@code null} if + * {@code string} has a length of zero or cannot be parsed as an integer + * value + * @since 11.0 + */ + @Beta + @CheckForNull + public static Integer tryParse(String string) { + return tryParse(string, 10); + } + + /** + * Parses the specified string as a signed integer value using the specified + * radix. The ASCII character {@code '-'} (<code>'\u002D'</code>) is + * recognized as the minus sign. + * + * <p>Unlike {@link Integer#parseInt(String, int)}, this method returns + * {@code null} instead of throwing an exception if parsing fails. + * Additionally, this method only accepts ASCII digits, and returns + * {@code null} if non-ASCII digits are present in the string. + * + * <p>Note that strings prefixed with ASCII {@code '+'} are rejected, even + * under JDK 7, despite the change to {@link Integer#parseInt(String, int)} + * for that version. + * + * @param string the string representation of an integer value + * @param radix the radix to use when parsing + * @return the integer value represented by {@code string} using + * {@code radix}, or {@code null} if {@code string} has a length of zero + * or cannot be parsed as an integer value + * @throws IllegalArgumentException if {@code radix < Character.MIN_RADIX} or + * {@code radix > Character.MAX_RADIX} + */ + @CheckForNull static Integer tryParse( + String string, int radix) { + if (checkNotNull(string).isEmpty()) { + return null; + } + if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) { + throw new IllegalArgumentException( + "radix must be between MIN_RADIX and MAX_RADIX but was " + radix); + } + boolean negative = string.charAt(0) == '-'; + int index = negative ? 1 : 0; + if (index == string.length()) { + return null; + } + int digit = digit(string.charAt(index++)); + if (digit < 0 || digit >= radix) { + return null; + } + int accum = -digit; + + int cap = Integer.MIN_VALUE / radix; + + while (index < string.length()) { + digit = digit(string.charAt(index++)); + if (digit < 0 || digit >= radix || accum < cap) { + return null; + } + accum *= radix; + if (accum < Integer.MIN_VALUE + digit) { + return null; + } + accum -= digit; + } + + if (negative) { + return accum; + } else if (accum == Integer.MIN_VALUE) { + return null; + } else { + return -accum; + } + } } diff --git a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Shorts.java b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Shorts.java index 1b7aafc8b..221255b13 100644 --- a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Shorts.java +++ b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Shorts.java @@ -112,8 +112,8 @@ public final class Shorts { * Compares the two specified {@code short} values. The sign of the value * returned is the same as that of {@code ((Short) a).compareTo(b)}. * - * <p><b>Note:</b> projects using JDK 7 or later should use the equivalent - * {@link Short#compare} method instead. + * <p><b>Note for Java 7 and later:</b> this method should be treated as + * deprecated; use the equivalent {@link Short#compare} method instead. * * @param a the first {@code short} to compare * @param b the second {@code short} to compare diff --git a/guava-gwt/test-super/com/google/common/base/super/com/google/common/base/EnumsTest.java b/guava-gwt/test-super/com/google/common/base/super/com/google/common/base/EnumsTest.java index ef7ac4653..c61855a8f 100644 --- a/guava-gwt/test-super/com/google/common/base/super/com/google/common/base/EnumsTest.java +++ b/guava-gwt/test-super/com/google/common/base/super/com/google/common/base/EnumsTest.java @@ -17,7 +17,6 @@ package com.google.common.base; import com.google.common.annotations.GwtCompatible; -import com.google.common.testing.EqualsTester; import com.google.common.testing.SerializableTester; import junit.framework.TestCase; @@ -41,33 +40,6 @@ public class EnumsTest extends TestCase { private enum OtherEnum {} - public void testValueOfFunction() { - Function<String, TestEnum> function = Enums.valueOfFunction(TestEnum.class); - assertEquals(TestEnum.CHEETO, function.apply("CHEETO")); - assertEquals(TestEnum.HONDA, function.apply("HONDA")); - assertEquals(TestEnum.POODLE, function.apply("POODLE")); - } - - public void testValueOfFunction_caseSensitive() { - Function<String, TestEnum> function = Enums.valueOfFunction(TestEnum.class); - assertNull(function.apply("cHEETO")); - assertNull(function.apply("Honda")); - assertNull(function.apply("poodlE")); - } - - public void testValueOfFunction_nullWhenNoMatchingConstant() { - Function<String, TestEnum> function = Enums.valueOfFunction(TestEnum.class); - assertNull(function.apply("WOMBAT")); - } - - public void testValueOfFunction_equals() { - new EqualsTester() - .addEqualityGroup( - Enums.valueOfFunction(TestEnum.class), Enums.valueOfFunction(TestEnum.class)) - .addEqualityGroup(Enums.valueOfFunction(OtherEnum.class)) - .testEquals(); - } - public void testGetIfPresent() { assertEquals(Optional.of(TestEnum.CHEETO), Enums.getIfPresent(TestEnum.class, "CHEETO")); assertEquals(Optional.of(TestEnum.HONDA), Enums.getIfPresent(TestEnum.class, "HONDA")); diff --git a/guava-gwt/test-super/com/google/common/base/super/com/google/common/base/OptionalTest.java b/guava-gwt/test-super/com/google/common/base/super/com/google/common/base/OptionalTest.java index 6b33a0ccb..6d785352b 100644 --- a/guava-gwt/test-super/com/google/common/base/super/com/google/common/base/OptionalTest.java +++ b/guava-gwt/test-super/com/google/common/base/super/com/google/common/base/OptionalTest.java @@ -16,7 +16,7 @@ package com.google.common.base; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.FluentIterable; @@ -218,34 +218,34 @@ public final class OptionalTest extends TestCase { public void testPresentInstances_allPresent() { List<Optional<String>> optionals = ImmutableList.of(Optional.of("a"), Optional.of("b"), Optional.of("c")); - ASSERT.that(Optional.presentInstances(optionals)).iteratesOverSequence("a", "b", "c"); + assertThat(Optional.presentInstances(optionals)).iteratesAs("a", "b", "c"); } public void testPresentInstances_allAbsent() { List<Optional<Object>> optionals = ImmutableList.of(Optional.absent(), Optional.absent()); - ASSERT.that(Optional.presentInstances(optionals)).isEmpty(); + assertThat(Optional.presentInstances(optionals)).isEmpty(); } public void testPresentInstances_somePresent() { List<Optional<String>> optionals = ImmutableList.of(Optional.of("a"), Optional.<String>absent(), Optional.of("c")); - ASSERT.that(Optional.presentInstances(optionals)).iteratesOverSequence("a", "c"); + assertThat(Optional.presentInstances(optionals)).iteratesAs("a", "c"); } public void testPresentInstances_callingIteratorTwice() { List<Optional<String>> optionals = ImmutableList.of(Optional.of("a"), Optional.<String>absent(), Optional.of("c")); Iterable<String> onlyPresent = Optional.presentInstances(optionals); - ASSERT.that(onlyPresent).iteratesOverSequence("a", "c"); - ASSERT.that(onlyPresent).iteratesOverSequence("a", "c"); + assertThat(onlyPresent).iteratesAs("a", "c"); + assertThat(onlyPresent).iteratesAs("a", "c"); } public void testPresentInstances_wildcards() { List<Optional<? extends Number>> optionals = ImmutableList.<Optional<? extends Number>>of(Optional.<Double>absent(), Optional.of(2)); Iterable<Number> onlyPresent = Optional.presentInstances(optionals); - ASSERT.that(onlyPresent).iteratesOverSequence(2); + assertThat(onlyPresent).iteratesAs(2); } private static Optional<Integer> getSomeOptionalInt() { diff --git a/guava-gwt/test-super/com/google/common/base/super/com/google/common/base/SplitterTest.java b/guava-gwt/test-super/com/google/common/base/super/com/google/common/base/SplitterTest.java index 829ce4bff..aabd88d56 100644 --- a/guava-gwt/test-super/com/google/common/base/super/com/google/common/base/SplitterTest.java +++ b/guava-gwt/test-super/com/google/common/base/super/com/google/common/base/SplitterTest.java @@ -16,7 +16,7 @@ package com.google.common.base; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.ImmutableList; @@ -48,7 +48,7 @@ public class SplitterTest extends TestCase { public void testCharacterSimpleSplit() { String simple = "a,b,c"; Iterable<String> letters = COMMA_SPLITTER.split(simple); - ASSERT.that(letters).iteratesOverSequence("a", "b", "c"); + assertThat(letters).iteratesAs("a", "b", "c"); } /** @@ -62,7 +62,7 @@ public class SplitterTest extends TestCase { public void testCharacterSimpleSplitToList() { String simple = "a,b,c"; List<String> letters = COMMA_SPLITTER.splitToList(simple); - ASSERT.that(letters).iteratesOverSequence("a", "b", "c"); + assertThat(letters).iteratesAs("a", "b", "c"); } public void testToString() { @@ -74,37 +74,37 @@ public class SplitterTest extends TestCase { public void testCharacterSimpleSplitWithNoDelimiter() { String simple = "a,b,c"; Iterable<String> letters = Splitter.on('.').split(simple); - ASSERT.that(letters).iteratesOverSequence("a,b,c"); + assertThat(letters).iteratesAs("a,b,c"); } public void testCharacterSplitWithDoubleDelimiter() { String doubled = "a,,b,c"; Iterable<String> letters = COMMA_SPLITTER.split(doubled); - ASSERT.that(letters).iteratesOverSequence("a", "", "b", "c"); + assertThat(letters).iteratesAs("a", "", "b", "c"); } public void testCharacterSplitWithDoubleDelimiterAndSpace() { String doubled = "a,, b,c"; Iterable<String> letters = COMMA_SPLITTER.split(doubled); - ASSERT.that(letters).iteratesOverSequence("a", "", " b", "c"); + assertThat(letters).iteratesAs("a", "", " b", "c"); } public void testCharacterSplitWithTrailingDelimiter() { String trailing = "a,b,c,"; Iterable<String> letters = COMMA_SPLITTER.split(trailing); - ASSERT.that(letters).iteratesOverSequence("a", "b", "c", ""); + assertThat(letters).iteratesAs("a", "b", "c", ""); } public void testCharacterSplitWithLeadingDelimiter() { String leading = ",a,b,c"; Iterable<String> letters = COMMA_SPLITTER.split(leading); - ASSERT.that(letters).iteratesOverSequence("", "a", "b", "c"); + assertThat(letters).iteratesAs("", "a", "b", "c"); } public void testCharacterSplitWithMulitpleLetters() { Iterable<String> testCharacteringMotto = Splitter.on('-').split( "Testing-rocks-Debugging-sucks"); - ASSERT.that(testCharacteringMotto).iteratesOverSequence( + assertThat(testCharacteringMotto).iteratesAs( "Testing", "rocks", "Debugging", "sucks"); } @@ -112,7 +112,7 @@ public class SplitterTest extends TestCase { Iterable<String> testCharacteringMotto = Splitter .on(CharMatcher.WHITESPACE) .split("Testing\nrocks\tDebugging sucks"); - ASSERT.that(testCharacteringMotto).iteratesOverSequence( + assertThat(testCharacteringMotto).iteratesAs( "Testing", "rocks", "Debugging", "sucks"); } @@ -120,40 +120,40 @@ public class SplitterTest extends TestCase { String doubled = "a..b.c"; Iterable<String> letters = Splitter.on('.') .omitEmptyStrings().split(doubled); - ASSERT.that(letters).iteratesOverSequence("a", "b", "c"); + assertThat(letters).iteratesAs("a", "b", "c"); } public void testCharacterSplitEmptyToken() { String emptyToken = "a. .c"; Iterable<String> letters = Splitter.on('.').trimResults() .split(emptyToken); - ASSERT.that(letters).iteratesOverSequence("a", "", "c"); + assertThat(letters).iteratesAs("a", "", "c"); } public void testCharacterSplitEmptyTokenOmitEmptyStrings() { String emptyToken = "a. .c"; Iterable<String> letters = Splitter.on('.') .omitEmptyStrings().trimResults().split(emptyToken); - ASSERT.that(letters).iteratesOverSequence("a", "c"); + assertThat(letters).iteratesAs("a", "c"); } public void testCharacterSplitOnEmptyString() { Iterable<String> nothing = Splitter.on('.').split(""); - ASSERT.that(nothing).iteratesOverSequence(""); + assertThat(nothing).iteratesAs(""); } public void testCharacterSplitOnEmptyStringOmitEmptyStrings() { - ASSERT.that(Splitter.on('.').omitEmptyStrings().split("")).isEmpty(); + assertThat(Splitter.on('.').omitEmptyStrings().split("")).isEmpty(); } public void testCharacterSplitOnOnlyDelimiter() { Iterable<String> blankblank = Splitter.on('.').split("."); - ASSERT.that(blankblank).iteratesOverSequence("", ""); + assertThat(blankblank).iteratesAs("", ""); } public void testCharacterSplitOnOnlyDelimitersOmitEmptyStrings() { Iterable<String> empty = Splitter.on('.').omitEmptyStrings().split("..."); - ASSERT.that(empty).isEmpty(); + assertThat(empty).isEmpty(); } public void testCharacterSplitWithTrim() { @@ -162,50 +162,50 @@ public class SplitterTest extends TestCase { Iterable<String> family = COMMA_SPLITTER .trimResults(CharMatcher.anyOf("afro").or(CharMatcher.WHITESPACE)) .split(jacksons); - ASSERT.that(family).iteratesOverSequence( + assertThat(family).iteratesAs( "(Marlon)", "(Michael)", "(Jackie)", "(Jemaine)", "(Tito)"); } public void testStringSimpleSplit() { String simple = "a,b,c"; Iterable<String> letters = Splitter.on(',').split(simple); - ASSERT.that(letters).iteratesOverSequence("a", "b", "c"); + assertThat(letters).iteratesAs("a", "b", "c"); } public void testStringSimpleSplitWithNoDelimiter() { String simple = "a,b,c"; Iterable<String> letters = Splitter.on('.').split(simple); - ASSERT.that(letters).iteratesOverSequence("a,b,c"); + assertThat(letters).iteratesAs("a,b,c"); } public void testStringSplitWithDoubleDelimiter() { String doubled = "a,,b,c"; Iterable<String> letters = Splitter.on(',').split(doubled); - ASSERT.that(letters).iteratesOverSequence("a", "", "b", "c"); + assertThat(letters).iteratesAs("a", "", "b", "c"); } public void testStringSplitWithDoubleDelimiterAndSpace() { String doubled = "a,, b,c"; Iterable<String> letters = Splitter.on(',').split(doubled); - ASSERT.that(letters).iteratesOverSequence("a", "", " b", "c"); + assertThat(letters).iteratesAs("a", "", " b", "c"); } public void testStringSplitWithTrailingDelimiter() { String trailing = "a,b,c,"; Iterable<String> letters = Splitter.on(',').split(trailing); - ASSERT.that(letters).iteratesOverSequence("a", "b", "c", ""); + assertThat(letters).iteratesAs("a", "b", "c", ""); } public void testStringSplitWithLeadingDelimiter() { String leading = ",a,b,c"; Iterable<String> letters = Splitter.on(',').split(leading); - ASSERT.that(letters).iteratesOverSequence("", "a", "b", "c"); + assertThat(letters).iteratesAs("", "a", "b", "c"); } public void testStringSplitWithMultipleLetters() { Iterable<String> testStringingMotto = Splitter.on('-').split( "Testing-rocks-Debugging-sucks"); - ASSERT.that(testStringingMotto).iteratesOverSequence( + assertThat(testStringingMotto).iteratesAs( "Testing", "rocks", "Debugging", "sucks"); } @@ -213,46 +213,46 @@ public class SplitterTest extends TestCase { String doubled = "a..b.c"; Iterable<String> letters = Splitter.on('.') .omitEmptyStrings().split(doubled); - ASSERT.that(letters).iteratesOverSequence("a", "b", "c"); + assertThat(letters).iteratesAs("a", "b", "c"); } public void testStringSplitEmptyToken() { String emptyToken = "a. .c"; Iterable<String> letters = Splitter.on('.').trimResults() .split(emptyToken); - ASSERT.that(letters).iteratesOverSequence("a", "", "c"); + assertThat(letters).iteratesAs("a", "", "c"); } public void testStringSplitEmptyTokenOmitEmptyStrings() { String emptyToken = "a. .c"; Iterable<String> letters = Splitter.on('.') .omitEmptyStrings().trimResults().split(emptyToken); - ASSERT.that(letters).iteratesOverSequence("a", "c"); + assertThat(letters).iteratesAs("a", "c"); } public void testStringSplitWithLongDelimiter() { String longDelimiter = "a, b, c"; Iterable<String> letters = Splitter.on(", ").split(longDelimiter); - ASSERT.that(letters).iteratesOverSequence("a", "b", "c"); + assertThat(letters).iteratesAs("a", "b", "c"); } public void testStringSplitWithLongLeadingDelimiter() { String longDelimiter = ", a, b, c"; Iterable<String> letters = Splitter.on(", ").split(longDelimiter); - ASSERT.that(letters).iteratesOverSequence("", "a", "b", "c"); + assertThat(letters).iteratesAs("", "a", "b", "c"); } public void testStringSplitWithLongTrailingDelimiter() { String longDelimiter = "a, b, c, "; Iterable<String> letters = Splitter.on(", ").split(longDelimiter); - ASSERT.that(letters).iteratesOverSequence("a", "b", "c", ""); + assertThat(letters).iteratesAs("a", "b", "c", ""); } public void testStringSplitWithDelimiterSubstringInValue() { String fourCommasAndFourSpaces = ",,,, "; Iterable<String> threeCommasThenThreeSpaces = Splitter.on(", ").split( fourCommasAndFourSpaces); - ASSERT.that(threeCommasThenThreeSpaces).iteratesOverSequence(",,,", " "); + assertThat(threeCommasThenThreeSpaces).iteratesAs(",,,", " "); } public void testStringSplitWithEmptyString() { @@ -265,21 +265,21 @@ public class SplitterTest extends TestCase { public void testStringSplitOnEmptyString() { Iterable<String> notMuch = Splitter.on('.').split(""); - ASSERT.that(notMuch).iteratesOverSequence(""); + assertThat(notMuch).iteratesAs(""); } public void testStringSplitOnEmptyStringOmitEmptyString() { - ASSERT.that(Splitter.on('.').omitEmptyStrings().split("")).isEmpty(); + assertThat(Splitter.on('.').omitEmptyStrings().split("")).isEmpty(); } public void testStringSplitOnOnlyDelimiter() { Iterable<String> blankblank = Splitter.on('.').split("."); - ASSERT.that(blankblank).iteratesOverSequence("", ""); + assertThat(blankblank).iteratesAs("", ""); } public void testStringSplitOnOnlyDelimitersOmitEmptyStrings() { Iterable<String> empty = Splitter.on('.').omitEmptyStrings().split("..."); - ASSERT.that(empty).isEmpty(); + assertThat(empty).isEmpty(); } public void testStringSplitWithTrim() { @@ -288,7 +288,7 @@ public class SplitterTest extends TestCase { Iterable<String> family = Splitter.on(',') .trimResults(CharMatcher.anyOf("afro").or(CharMatcher.WHITESPACE)) .split(jacksons); - ASSERT.that(family).iteratesOverSequence( + assertThat(family).iteratesAs( "(Marlon)", "(Michael)", "(Jackie)", "(Jemaine)", "(Tito)"); } @@ -341,41 +341,41 @@ public class SplitterTest extends TestCase { public void testFixedLengthSimpleSplit() { String simple = "abcde"; Iterable<String> letters = Splitter.fixedLength(2).split(simple); - ASSERT.that(letters).iteratesOverSequence("ab", "cd", "e"); + assertThat(letters).iteratesAs("ab", "cd", "e"); } public void testFixedLengthSplitEqualChunkLength() { String simple = "abcdef"; Iterable<String> letters = Splitter.fixedLength(2).split(simple); - ASSERT.that(letters).iteratesOverSequence("ab", "cd", "ef"); + assertThat(letters).iteratesAs("ab", "cd", "ef"); } public void testFixedLengthSplitOnlyOneChunk() { String simple = "abc"; Iterable<String> letters = Splitter.fixedLength(3).split(simple); - ASSERT.that(letters).iteratesOverSequence("abc"); + assertThat(letters).iteratesAs("abc"); } public void testFixedLengthSplitSmallerString() { String simple = "ab"; Iterable<String> letters = Splitter.fixedLength(3).split(simple); - ASSERT.that(letters).iteratesOverSequence("ab"); + assertThat(letters).iteratesAs("ab"); } public void testFixedLengthSplitEmptyString() { String simple = ""; Iterable<String> letters = Splitter.fixedLength(3).split(simple); - ASSERT.that(letters).iteratesOverSequence(""); + assertThat(letters).iteratesAs(""); } public void testFixedLengthSplitEmptyStringWithOmitEmptyStrings() { - ASSERT.that(Splitter.fixedLength(3).omitEmptyStrings().split("")).isEmpty(); + assertThat(Splitter.fixedLength(3).omitEmptyStrings().split("")).isEmpty(); } public void testFixedLengthSplitIntoChars() { String simple = "abcd"; Iterable<String> letters = Splitter.fixedLength(1).split(simple); - ASSERT.that(letters).iteratesOverSequence("a", "b", "c", "d"); + assertThat(letters).iteratesAs("a", "b", "c", "d"); } public void testFixedLengthSplitZeroChunkLen() { @@ -397,79 +397,79 @@ public class SplitterTest extends TestCase { public void testLimitLarge() { String simple = "abcd"; Iterable<String> letters = Splitter.fixedLength(1).limit(100).split(simple); - ASSERT.that(letters).iteratesOverSequence("a", "b", "c", "d"); + assertThat(letters).iteratesAs("a", "b", "c", "d"); } public void testLimitOne() { String simple = "abcd"; Iterable<String> letters = Splitter.fixedLength(1).limit(1).split(simple); - ASSERT.that(letters).iteratesOverSequence("abcd"); + assertThat(letters).iteratesAs("abcd"); } public void testLimitFixedLength() { String simple = "abcd"; Iterable<String> letters = Splitter.fixedLength(1).limit(2).split(simple); - ASSERT.that(letters).iteratesOverSequence("a", "bcd"); + assertThat(letters).iteratesAs("a", "bcd"); } public void testLimitSeparator() { String simple = "a,b,c,d"; Iterable<String> items = COMMA_SPLITTER.limit(2).split(simple); - ASSERT.that(items).iteratesOverSequence("a", "b,c,d"); + assertThat(items).iteratesAs("a", "b,c,d"); } public void testLimitExtraSeparators() { String text = "a,,,b,,c,d"; Iterable<String> items = COMMA_SPLITTER.limit(2).split(text); - ASSERT.that(items).iteratesOverSequence("a", ",,b,,c,d"); + assertThat(items).iteratesAs("a", ",,b,,c,d"); } public void testLimitExtraSeparatorsOmitEmpty() { String text = "a,,,b,,c,d"; Iterable<String> items = COMMA_SPLITTER.limit(2).omitEmptyStrings().split(text); - ASSERT.that(items).iteratesOverSequence("a", "b,,c,d"); + assertThat(items).iteratesAs("a", "b,,c,d"); } public void testLimitExtraSeparatorsOmitEmpty3() { String text = "a,,,b,,c,d"; Iterable<String> items = COMMA_SPLITTER.limit(3).omitEmptyStrings().split(text); - ASSERT.that(items).iteratesOverSequence("a", "b", "c,d"); + assertThat(items).iteratesAs("a", "b", "c,d"); } public void testLimitExtraSeparatorsTrim() { String text = ",,a,, , b ,, c,d "; Iterable<String> items = COMMA_SPLITTER.limit(2).omitEmptyStrings().trimResults().split(text); - ASSERT.that(items).iteratesOverSequence("a", "b ,, c,d"); + assertThat(items).iteratesAs("a", "b ,, c,d"); } public void testLimitExtraSeparatorsTrim3() { String text = ",,a,, , b ,, c,d "; Iterable<String> items = COMMA_SPLITTER.limit(3).omitEmptyStrings().trimResults().split(text); - ASSERT.that(items).iteratesOverSequence("a", "b", "c,d"); + assertThat(items).iteratesAs("a", "b", "c,d"); } public void testLimitExtraSeparatorsTrim1() { String text = ",,a,, , b ,, c,d "; Iterable<String> items = COMMA_SPLITTER.limit(1).omitEmptyStrings().trimResults().split(text); - ASSERT.that(items).iteratesOverSequence("a,, , b ,, c,d"); + assertThat(items).iteratesAs("a,, , b ,, c,d"); } public void testLimitExtraSeparatorsTrim1NoOmit() { String text = ",,a,, , b ,, c,d "; Iterable<String> items = COMMA_SPLITTER.limit(1).trimResults().split(text); - ASSERT.that(items).iteratesOverSequence(",,a,, , b ,, c,d"); + assertThat(items).iteratesAs(",,a,, , b ,, c,d"); } public void testLimitExtraSeparatorsTrim1Empty() { String text = ""; Iterable<String> items = COMMA_SPLITTER.limit(1).split(text); - ASSERT.that(items).iteratesOverSequence(""); + assertThat(items).iteratesAs(""); } public void testLimitExtraSeparatorsTrim1EmptyOmit() { String text = ""; Iterable<String> items = COMMA_SPLITTER.omitEmptyStrings().limit(1).split(text); - ASSERT.that(items).isEmpty(); + assertThat(items).isEmpty(); } @SuppressWarnings("ReturnValueIgnored") // testing for exception @@ -492,8 +492,8 @@ public class SplitterTest extends TestCase { .split("boy : tom , girl: tina , cat : kitty , dog: tommy "); ImmutableMap<String, String> expected = ImmutableMap.of("boy", "tom", "girl", "tina", "cat", "kitty", "dog", "tommy"); - ASSERT.that(m).isEqualTo(expected); - ASSERT.that(asList(m.entrySet())).is(asList(expected.entrySet())); + assertThat(m).isEqualTo(expected); + assertThat(asList(m.entrySet())).isEqualTo(asList(expected.entrySet())); } public void testMapSplitter_trimmedEntries() { @@ -504,8 +504,8 @@ public class SplitterTest extends TestCase { ImmutableMap<String, String> expected = ImmutableMap.of("boy ", " tom", "girl", " tina", "cat ", " kitty", "dog", " tommy"); - ASSERT.that(m).isEqualTo(expected); - ASSERT.that(asList(m.entrySet())).is(asList(expected.entrySet())); + assertThat(m).isEqualTo(expected); + assertThat(asList(m.entrySet())).isEqualTo(asList(expected.entrySet())); } public void testMapSplitter_trimmedKeyValue() { @@ -514,8 +514,8 @@ public class SplitterTest extends TestCase { "boy : tom , girl: tina , cat : kitty , dog: tommy "); ImmutableMap<String, String> expected = ImmutableMap.of("boy", "tom", "girl", "tina", "cat", "kitty", "dog", "tommy"); - ASSERT.that(m).isEqualTo(expected); - ASSERT.that(asList(m.entrySet())).is(asList(expected.entrySet())); + assertThat(m).isEqualTo(expected); + assertThat(asList(m.entrySet())).isEqualTo(asList(expected.entrySet())); } public void testMapSplitter_notTrimmed() { @@ -523,8 +523,8 @@ public class SplitterTest extends TestCase { " boy:tom , girl: tina , cat :kitty , dog: tommy "); ImmutableMap<String, String> expected = ImmutableMap.of(" boy", "tom ", " girl", " tina ", " cat ", "kitty ", " dog", " tommy "); - ASSERT.that(m).isEqualTo(expected); - ASSERT.that(asList(m.entrySet())).is(asList(expected.entrySet())); + assertThat(m).isEqualTo(expected); + assertThat(asList(m.entrySet())).isEqualTo(asList(expected.entrySet())); } public void testMapSplitter_CharacterSeparator() { @@ -536,8 +536,8 @@ public class SplitterTest extends TestCase { ImmutableMap<String, String> expected = ImmutableMap.of("boy", "tom", "girl", "tina", "cat", "kitty", "dog", "tommy"); - ASSERT.that(m).isEqualTo(expected); - ASSERT.that(asList(m.entrySet())).is(asList(expected.entrySet())); + assertThat(m).isEqualTo(expected); + assertThat(asList(m.entrySet())).isEqualTo(asList(expected.entrySet())); } public void testMapSplitter_multiCharacterSeparator() { @@ -549,8 +549,8 @@ public class SplitterTest extends TestCase { ImmutableMap<String, String> expected = ImmutableMap.of("boy", "tom", "girl", "tina", "cat", "kitty", "dog", "tommy"); - ASSERT.that(m).isEqualTo(expected); - ASSERT.that(asList(m.entrySet())).is(asList(expected.entrySet())); + assertThat(m).isEqualTo(expected); + assertThat(asList(m.entrySet())).isEqualTo(asList(expected.entrySet())); } @SuppressWarnings("ReturnValueIgnored") // testing for exception @@ -575,8 +575,8 @@ public class SplitterTest extends TestCase { .withKeyValueSeparator(":") .split("boy:tom,girl:tina,cat:kitty,dog:tommy"); - ASSERT.that(m.keySet()).iteratesOverSequence("boy", "girl", "cat", "dog"); - ASSERT.that(m).isEqualTo( + assertThat(m.keySet()).iteratesAs("boy", "girl", "cat", "dog"); + assertThat(m).isEqualTo( ImmutableMap.of("boy", "tom", "girl", "tina", "cat", "kitty", "dog", "tommy")); // try in a different order @@ -584,8 +584,8 @@ public class SplitterTest extends TestCase { .withKeyValueSeparator(":") .split("girl:tina,boy:tom,dog:tommy,cat:kitty"); - ASSERT.that(m.keySet()).iteratesOverSequence("girl", "boy", "dog", "cat"); - ASSERT.that(m).isEqualTo( + assertThat(m.keySet()).iteratesAs("girl", "boy", "dog", "cat"); + assertThat(m).isEqualTo( ImmutableMap.of("boy", "tom", "girl", "tina", "cat", "kitty", "dog", "tommy")); } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/AbstractImmutableSetTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/AbstractImmutableSetTest.java index 1826fb6d9..b16137adf 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/AbstractImmutableSetTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/AbstractImmutableSetTest.java @@ -16,8 +16,8 @@ package com.google.common.collect; +import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.MinimalCollection; @@ -271,7 +271,7 @@ public abstract class AbstractImmutableSetTest extends TestCase { .add("d", "e", "f") .add("g", "h", "i", "j") .build(); - ASSERT.that(set).has().exactly( + assertThat(set).has().exactly( "a", "b", "c", "d", "e", "f", "g", "h", "i", "j").inOrder(); } @@ -279,9 +279,9 @@ public abstract class AbstractImmutableSetTest extends TestCase { ImmutableSet.Builder<String> builder = this.<String>builder() .add("a") .add("b"); - ASSERT.that(builder.build()).has().exactly("a", "b").inOrder(); + assertThat(builder.build()).has().exactly("a", "b").inOrder(); builder.add("c", "d"); - ASSERT.that(builder.build()).has().exactly("a", "b", "c", "d").inOrder(); + assertThat(builder.build()).has().exactly("a", "b", "c", "d").inOrder(); } public void testBuilderWithDuplicateElements() { @@ -301,9 +301,9 @@ public abstract class AbstractImmutableSetTest extends TestCase { .add("a") .add("a", "a") .add("b"); - ASSERT.that(builder.build()).has().exactly("a", "b").inOrder(); + assertThat(builder.build()).has().exactly("a", "b").inOrder(); builder.add("a", "b", "c", "c"); - ASSERT.that(builder.build()).has().exactly("a", "b", "c").inOrder(); + assertThat(builder.build()).has().exactly("a", "b", "c").inOrder(); } public void testBuilderAddAll() { @@ -313,7 +313,7 @@ public abstract class AbstractImmutableSetTest extends TestCase { .addAll(a) .addAll(b) .build(); - ASSERT.that(set).has().exactly("a", "b", "c", "d", "e").inOrder(); + assertThat(set).has().exactly("a", "b", "c", "d", "e").inOrder(); } static final int LAST_COLOR_ADDED = 0x00BFFF; diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/AbstractSequentialIteratorTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/AbstractSequentialIteratorTest.java index 85d641eba..81b9b854d 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/AbstractSequentialIteratorTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/AbstractSequentialIteratorTest.java @@ -16,7 +16,7 @@ package com.google.common.collect; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; @@ -37,7 +37,7 @@ public class AbstractSequentialIteratorTest extends TestCase { return newDoubler(2, 32); } }; - ASSERT.that(doubled).iteratesOverSequence(2, 4, 8, 16, 32); + assertThat(doubled).iteratesAs(2, 4, 8, 16, 32); } public void testSampleCode() { @@ -52,7 +52,7 @@ public class AbstractSequentialIteratorTest extends TestCase { return powersOfTwo; } }; - ASSERT.that(actual).iteratesOverSequence(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, + assertThat(actual).iteratesAs(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824); } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/AbstractTableReadTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/AbstractTableReadTest.java index 11581ba8a..342b11260 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/AbstractTableReadTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/AbstractTableReadTest.java @@ -16,7 +16,7 @@ package com.google.common.collect; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Objects; @@ -181,7 +181,7 @@ public abstract class AbstractTableReadTest extends TestCase { public void testColumnSetPartialOverlap() { table = create( "foo", 1, 'a', "bar", 1, 'b', "foo", 2, 'c', "bar", 3, 'd'); - ASSERT.that(table.columnKeySet()).has().exactly(1, 2, 3); + assertThat(table.columnKeySet()).has().exactly(1, 2, 3); } } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ArrayListMultimapTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ArrayListMultimapTest.java index 9c8aba491..18339cca9 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ArrayListMultimapTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ArrayListMultimapTest.java @@ -16,8 +16,8 @@ package com.google.common.collect; +import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; @@ -82,9 +82,9 @@ public class ArrayListMultimapTest extends TestCase { ListMultimap<String, Integer> multimap = create(); multimap.putAll("foo", asList(1, 2, 3, 4, 5)); List<Integer> list = multimap.get("foo"); - ASSERT.that(multimap.get("foo")).has().exactly(1, 2, 3, 4, 5).inOrder(); + assertThat(multimap.get("foo")).has().exactly(1, 2, 3, 4, 5).inOrder(); List<Integer> sublist = list.subList(0, 5); - ASSERT.that(sublist).has().exactly(1, 2, 3, 4, 5).inOrder(); + assertThat(sublist).has().exactly(1, 2, 3, 4, 5).inOrder(); sublist.clear(); assertTrue(sublist.isEmpty()); @@ -153,8 +153,8 @@ public class ArrayListMultimapTest extends TestCase { multimap.put("bar", 3); multimap.trimToSize(); assertEquals(3, multimap.size()); - ASSERT.that(multimap.get("foo")).has().exactly(1, 2).inOrder(); - ASSERT.that(multimap.get("bar")).has().item(3); + assertThat(multimap.get("foo")).has().exactly(1, 2).inOrder(); + assertThat(multimap.get("bar")).has().item(3); } } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ArrayTableTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ArrayTableTest.java index 9f3af8f7d..76cc8704b 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ArrayTableTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ArrayTableTest.java @@ -16,8 +16,8 @@ package com.google.common.collect; +import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Objects; @@ -279,13 +279,13 @@ public class ArrayTableTest extends AbstractTableTest { public void testRowKeyList() { ArrayTable<String, Integer, Character> table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c'); - ASSERT.that(table.rowKeyList()).has().exactly("foo", "bar", "cat").inOrder(); + assertThat(table.rowKeyList()).has().exactly("foo", "bar", "cat").inOrder(); } public void testColumnKeyList() { ArrayTable<String, Integer, Character> table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c'); - ASSERT.that(table.columnKeyList()).has().exactly(1, 2, 3).inOrder(); + assertThat(table.columnKeyList()).has().exactly(1, 2, 3).inOrder(); } public void testGetMissingKeys() { diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/Collections2Test.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/Collections2Test.java index 3529efd4b..31e19a487 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/Collections2Test.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/Collections2Test.java @@ -18,9 +18,9 @@ package com.google.common.collect; import static com.google.common.collect.Iterables.concat; import static com.google.common.collect.Lists.newArrayList; +import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; import static java.util.Collections.nCopies; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Function; @@ -79,7 +79,7 @@ public class Collections2Test extends TestCase { Collections2.orderedPermutations(list); assertEquals(1, permutationSet.size()); - ASSERT.that(permutationSet).has().item(list); + assertThat(permutationSet).has().item(list); Iterator<List<Integer>> permutations = permutationSet.iterator(); diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ContiguousSetTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ContiguousSetTest.java index fcbb9442d..ea7efe121 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ContiguousSetTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ContiguousSetTest.java @@ -19,7 +19,7 @@ package com.google.common.collect; import static com.google.common.collect.BoundType.CLOSED; import static com.google.common.collect.BoundType.OPEN; import static com.google.common.collect.DiscreteDomain.integers; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.testing.EqualsTester; @@ -107,53 +107,53 @@ public class ContiguousSetTest extends TestCase { public void testHeadSet() { ImmutableSortedSet<Integer> set = ContiguousSet.create(Range.closed(1, 3), integers()); - ASSERT.that(set.headSet(1)).isEmpty(); - ASSERT.that(set.headSet(2)).has().item(1); - ASSERT.that(set.headSet(3)).has().exactly(1, 2).inOrder(); - ASSERT.that(set.headSet(4)).has().exactly(1, 2, 3).inOrder(); - ASSERT.that(set.headSet(Integer.MAX_VALUE)).has().exactly(1, 2, 3).inOrder(); - ASSERT.that(set.headSet(1, true)).has().item(1); - ASSERT.that(set.headSet(2, true)).has().exactly(1, 2).inOrder(); - ASSERT.that(set.headSet(3, true)).has().exactly(1, 2, 3).inOrder(); - ASSERT.that(set.headSet(4, true)).has().exactly(1, 2, 3).inOrder(); - ASSERT.that(set.headSet(Integer.MAX_VALUE, true)).has().exactly(1, 2, 3).inOrder(); + assertThat(set.headSet(1)).isEmpty(); + assertThat(set.headSet(2)).has().item(1); + assertThat(set.headSet(3)).has().exactly(1, 2).inOrder(); + assertThat(set.headSet(4)).has().exactly(1, 2, 3).inOrder(); + assertThat(set.headSet(Integer.MAX_VALUE)).has().exactly(1, 2, 3).inOrder(); + assertThat(set.headSet(1, true)).has().item(1); + assertThat(set.headSet(2, true)).has().exactly(1, 2).inOrder(); + assertThat(set.headSet(3, true)).has().exactly(1, 2, 3).inOrder(); + assertThat(set.headSet(4, true)).has().exactly(1, 2, 3).inOrder(); + assertThat(set.headSet(Integer.MAX_VALUE, true)).has().exactly(1, 2, 3).inOrder(); } public void testHeadSet_tooSmall() { - ASSERT.that(ContiguousSet.create(Range.closed(1, 3), integers()).headSet(0)).isEmpty(); + assertThat(ContiguousSet.create(Range.closed(1, 3), integers()).headSet(0)).isEmpty(); } public void testTailSet() { ImmutableSortedSet<Integer> set = ContiguousSet.create(Range.closed(1, 3), integers()); - ASSERT.that(set.tailSet(Integer.MIN_VALUE)).has().exactly(1, 2, 3).inOrder(); - ASSERT.that(set.tailSet(1)).has().exactly(1, 2, 3).inOrder(); - ASSERT.that(set.tailSet(2)).has().exactly(2, 3).inOrder(); - ASSERT.that(set.tailSet(3)).has().item(3); - ASSERT.that(set.tailSet(Integer.MIN_VALUE, false)).has().exactly(1, 2, 3).inOrder(); - ASSERT.that(set.tailSet(1, false)).has().exactly(2, 3).inOrder(); - ASSERT.that(set.tailSet(2, false)).has().item(3); - ASSERT.that(set.tailSet(3, false)).isEmpty(); + assertThat(set.tailSet(Integer.MIN_VALUE)).has().exactly(1, 2, 3).inOrder(); + assertThat(set.tailSet(1)).has().exactly(1, 2, 3).inOrder(); + assertThat(set.tailSet(2)).has().exactly(2, 3).inOrder(); + assertThat(set.tailSet(3)).has().item(3); + assertThat(set.tailSet(Integer.MIN_VALUE, false)).has().exactly(1, 2, 3).inOrder(); + assertThat(set.tailSet(1, false)).has().exactly(2, 3).inOrder(); + assertThat(set.tailSet(2, false)).has().item(3); + assertThat(set.tailSet(3, false)).isEmpty(); } public void testTailSet_tooLarge() { - ASSERT.that(ContiguousSet.create(Range.closed(1, 3), integers()).tailSet(4)).isEmpty(); + assertThat(ContiguousSet.create(Range.closed(1, 3), integers()).tailSet(4)).isEmpty(); } public void testSubSet() { ImmutableSortedSet<Integer> set = ContiguousSet.create(Range.closed(1, 3), integers()); - ASSERT.that(set.subSet(1, 4)).has().exactly(1, 2, 3).inOrder(); - ASSERT.that(set.subSet(2, 4)).has().exactly(2, 3).inOrder(); - ASSERT.that(set.subSet(3, 4)).has().item(3); - ASSERT.that(set.subSet(3, 3)).isEmpty(); - ASSERT.that(set.subSet(2, 3)).has().item(2); - ASSERT.that(set.subSet(1, 3)).has().exactly(1, 2).inOrder(); - ASSERT.that(set.subSet(1, 2)).has().item(1); - ASSERT.that(set.subSet(2, 2)).isEmpty(); - ASSERT.that(set.subSet(Integer.MIN_VALUE, Integer.MAX_VALUE)).has().exactly(1, 2, 3).inOrder(); - ASSERT.that(set.subSet(1, true, 3, true)).has().exactly(1, 2, 3).inOrder(); - ASSERT.that(set.subSet(1, false, 3, true)).has().exactly(2, 3).inOrder(); - ASSERT.that(set.subSet(1, true, 3, false)).has().exactly(1, 2).inOrder(); - ASSERT.that(set.subSet(1, false, 3, false)).has().item(2); + assertThat(set.subSet(1, 4)).has().exactly(1, 2, 3).inOrder(); + assertThat(set.subSet(2, 4)).has().exactly(2, 3).inOrder(); + assertThat(set.subSet(3, 4)).has().item(3); + assertThat(set.subSet(3, 3)).isEmpty(); + assertThat(set.subSet(2, 3)).has().item(2); + assertThat(set.subSet(1, 3)).has().exactly(1, 2).inOrder(); + assertThat(set.subSet(1, 2)).has().item(1); + assertThat(set.subSet(2, 2)).isEmpty(); + assertThat(set.subSet(Integer.MIN_VALUE, Integer.MAX_VALUE)).has().exactly(1, 2, 3).inOrder(); + assertThat(set.subSet(1, true, 3, true)).has().exactly(1, 2, 3).inOrder(); + assertThat(set.subSet(1, false, 3, true)).has().exactly(2, 3).inOrder(); + assertThat(set.subSet(1, true, 3, false)).has().exactly(1, 2).inOrder(); + assertThat(set.subSet(1, false, 3, false)).has().item(2); } public void testSubSet_outOfOrder() { @@ -165,11 +165,11 @@ public class ContiguousSetTest extends TestCase { } public void testSubSet_tooLarge() { - ASSERT.that(ContiguousSet.create(Range.closed(1, 3), integers()).subSet(4, 6)).isEmpty(); + assertThat(ContiguousSet.create(Range.closed(1, 3), integers()).subSet(4, 6)).isEmpty(); } public void testSubSet_tooSmall() { - ASSERT.that(ContiguousSet.create(Range.closed(1, 3), integers()).subSet(-1, 0)).isEmpty(); + assertThat(ContiguousSet.create(Range.closed(1, 3), integers()).subSet(-1, 0)).isEmpty(); } public void testFirst() { diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/EnumBiMapTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/EnumBiMapTest.java index 7cfc7060d..bed6626f6 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/EnumBiMapTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/EnumBiMapTest.java @@ -17,7 +17,7 @@ package com.google.common.collect; import static com.google.common.collect.testing.Helpers.orderEntriesByKey; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.Helpers; @@ -172,16 +172,16 @@ public class EnumBiMapTest extends TestCase { EnumBiMap<Currency, Country> bimap = EnumBiMap.create(map); // forward map ordered by currency - ASSERT.that(bimap.keySet()) + assertThat(bimap.keySet()) .has().exactly(Currency.DOLLAR, Currency.FRANC, Currency.PESO).inOrder(); // forward map ordered by currency (even for country values) - ASSERT.that(bimap.values()) + assertThat(bimap.values()) .has().exactly(Country.CANADA, Country.SWITZERLAND, Country.CHILE).inOrder(); // backward map ordered by country - ASSERT.that(bimap.inverse().keySet()) + assertThat(bimap.inverse().keySet()) .has().exactly(Country.CANADA, Country.CHILE, Country.SWITZERLAND).inOrder(); // backward map ordered by country (even for currency values) - ASSERT.that(bimap.inverse().values()) + assertThat(bimap.inverse().values()) .has().exactly(Currency.DOLLAR, Currency.PESO, Currency.FRANC).inOrder(); } @@ -199,16 +199,16 @@ public class EnumBiMapTest extends TestCase { iter.remove(); // forward map ordered by currency - ASSERT.that(bimap.keySet()) + assertThat(bimap.keySet()) .has().exactly(Currency.FRANC, Currency.PESO).inOrder(); // forward map ordered by currency (even for country values) - ASSERT.that(bimap.values()) + assertThat(bimap.values()) .has().exactly(Country.SWITZERLAND, Country.CHILE).inOrder(); // backward map ordered by country - ASSERT.that(bimap.inverse().keySet()) + assertThat(bimap.inverse().keySet()) .has().exactly(Country.CHILE, Country.SWITZERLAND).inOrder(); // backward map ordered by country (even for currency values) - ASSERT.that(bimap.inverse().values()) + assertThat(bimap.inverse().values()) .has().exactly(Currency.PESO, Currency.FRANC).inOrder(); } @@ -227,16 +227,16 @@ public class EnumBiMapTest extends TestCase { iter.remove(); // forward map ordered by currency - ASSERT.that(bimap.keySet()) + assertThat(bimap.keySet()) .has().exactly(Currency.DOLLAR, Currency.PESO).inOrder(); // forward map ordered by currency (even for country values) - ASSERT.that(bimap.values()) + assertThat(bimap.values()) .has().exactly(Country.CANADA, Country.CHILE).inOrder(); // backward map ordered by country - ASSERT.that(bimap.inverse().keySet()) + assertThat(bimap.inverse().keySet()) .has().exactly(Country.CANADA, Country.CHILE).inOrder(); // backward map ordered by country (even for currency values) - ASSERT.that(bimap.inverse().values()) + assertThat(bimap.inverse().values()) .has().exactly(Currency.DOLLAR, Currency.PESO).inOrder(); } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableBiMapTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableBiMapTest.java index 30ede6094..514effeb4 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableBiMapTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableBiMapTest.java @@ -16,7 +16,7 @@ package com.google.common.collect; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Joiner; @@ -404,7 +404,7 @@ public class ImmutableBiMapTest extends TestCase { ImmutableMap.of("one", 1, "two", 2, "three", 3, "four", 4)); Set<String> keys = bimap.keySet(); assertEquals(Sets.newHashSet("one", "two", "three", "four"), keys); - ASSERT.that(keys).has().exactly("one", "two", "three", "four").inOrder(); + assertThat(keys).has().exactly("one", "two", "three", "four").inOrder(); } public void testValues() { @@ -412,7 +412,7 @@ public class ImmutableBiMapTest extends TestCase { ImmutableMap.of("one", 1, "two", 2, "three", 3, "four", 4)); Set<Integer> values = bimap.values(); assertEquals(Sets.newHashSet(1, 2, 3, 4), values); - ASSERT.that(values).has().exactly(1, 2, 3, 4).inOrder(); + assertThat(values).has().exactly(1, 2, 3, 4).inOrder(); } public void testDoubleInverse() { diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableEnumMapTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableEnumMapTest.java index 2fc26fd1a..1233a9381 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableEnumMapTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableEnumMapTest.java @@ -16,7 +16,7 @@ package com.google.common.collect; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.AnEnum; @@ -55,7 +55,7 @@ public class ImmutableEnumMapTest extends TestCase { ImmutableMap<AnEnum, String> map = Maps.immutableEnumMap( ImmutableMap.of(AnEnum.C, "c", AnEnum.A, "a", AnEnum.E, "e")); - ASSERT.that(map.entrySet()).has().exactly( + assertThat(map.entrySet()).has().exactly( Helpers.mapEntry(AnEnum.A, "a"), Helpers.mapEntry(AnEnum.C, "c"), Helpers.mapEntry(AnEnum.E, "e")).inOrder(); diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableListMultimapTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableListMultimapTest.java index f6c065797..b71caa81c 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableListMultimapTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableListMultimapTest.java @@ -16,7 +16,7 @@ package com.google.common.collect; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.ImmutableListMultimap.Builder; @@ -239,10 +239,10 @@ public class ImmutableListMultimapTest extends TestCase { builder.put("a", 2); builder.put("b", 6); ImmutableListMultimap<String, Integer> multimap = builder.build(); - ASSERT.that(multimap.keySet()).has().exactly("d", "c", "b", "a").inOrder(); - ASSERT.that(multimap.values()).has().exactly(2, 4, 3, 6, 5, 2).inOrder(); - ASSERT.that(multimap.get("a")).has().exactly(5, 2).inOrder(); - ASSERT.that(multimap.get("b")).has().exactly(3, 6).inOrder(); + assertThat(multimap.keySet()).has().exactly("d", "c", "b", "a").inOrder(); + assertThat(multimap.values()).has().exactly(2, 4, 3, 6, 5, 2).inOrder(); + assertThat(multimap.get("a")).has().exactly(5, 2).inOrder(); + assertThat(multimap.get("b")).has().exactly(3, 6).inOrder(); } public void testBuilderOrderKeysByDuplicates() { @@ -261,10 +261,10 @@ public class ImmutableListMultimapTest extends TestCase { builder.put("a", 2); builder.put("bb", 6); ImmutableListMultimap<String, Integer> multimap = builder.build(); - ASSERT.that(multimap.keySet()).has().exactly("d", "a", "bb", "cc").inOrder(); - ASSERT.that(multimap.values()).has().exactly(2, 5, 2, 3, 6, 4).inOrder(); - ASSERT.that(multimap.get("a")).has().exactly(5, 2).inOrder(); - ASSERT.that(multimap.get("bb")).has().exactly(3, 6).inOrder(); + assertThat(multimap.keySet()).has().exactly("d", "a", "bb", "cc").inOrder(); + assertThat(multimap.values()).has().exactly(2, 5, 2, 3, 6, 4).inOrder(); + assertThat(multimap.get("a")).has().exactly(5, 2).inOrder(); + assertThat(multimap.get("bb")).has().exactly(3, 6).inOrder(); } public void testBuilderOrderValuesBy() { @@ -278,10 +278,10 @@ public class ImmutableListMultimapTest extends TestCase { builder.put("a", 2); builder.put("b", 6); ImmutableListMultimap<String, Integer> multimap = builder.build(); - ASSERT.that(multimap.keySet()).has().exactly("b", "d", "a", "c").inOrder(); - ASSERT.that(multimap.values()).has().exactly(6, 3, 2, 5, 2, 4).inOrder(); - ASSERT.that(multimap.get("a")).has().exactly(5, 2).inOrder(); - ASSERT.that(multimap.get("b")).has().exactly(6, 3).inOrder(); + assertThat(multimap.keySet()).has().exactly("b", "d", "a", "c").inOrder(); + assertThat(multimap.values()).has().exactly(6, 3, 2, 5, 2, 4).inOrder(); + assertThat(multimap.get("a")).has().exactly(5, 2).inOrder(); + assertThat(multimap.get("b")).has().exactly(6, 3).inOrder(); } public void testBuilderOrderKeysAndValuesBy() { @@ -296,10 +296,10 @@ public class ImmutableListMultimapTest extends TestCase { builder.put("a", 2); builder.put("b", 6); ImmutableListMultimap<String, Integer> multimap = builder.build(); - ASSERT.that(multimap.keySet()).has().exactly("d", "c", "b", "a").inOrder(); - ASSERT.that(multimap.values()).has().exactly(2, 4, 6, 3, 5, 2).inOrder(); - ASSERT.that(multimap.get("a")).has().exactly(5, 2).inOrder(); - ASSERT.that(multimap.get("b")).has().exactly(6, 3).inOrder(); + assertThat(multimap.keySet()).has().exactly("d", "c", "b", "a").inOrder(); + assertThat(multimap.values()).has().exactly(2, 4, 6, 3, 5, 2).inOrder(); + assertThat(multimap.get("a")).has().exactly(5, 2).inOrder(); + assertThat(multimap.get("b")).has().exactly(6, 3).inOrder(); } public void testCopyOf() { diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableMultisetTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableMultisetTest.java index f1092a33b..5396ef2af 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableMultisetTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableMultisetTest.java @@ -16,8 +16,8 @@ package com.google.common.collect; +import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.MinimalCollection; @@ -348,13 +348,13 @@ public class ImmutableMultisetTest extends TestCase { Collection<String> c = ImmutableMultiset.of("a", "b", "a"); assertEquals(c, ImmutableMultiset.of("a", "b", "a")); assertEquals(c, ImmutableMultiset.of("a", "a", "b")); - ASSERT.that(c).isNotEqualTo(ImmutableMultiset.of("a", "b")); - ASSERT.that(c).isNotEqualTo(ImmutableMultiset.of("a", "b", "c", "d")); + assertThat(c).isNotEqualTo(ImmutableMultiset.of("a", "b")); + assertThat(c).isNotEqualTo(ImmutableMultiset.of("a", "b", "c", "d")); } public void testIterationOrder() { Collection<String> c = ImmutableMultiset.of("a", "b", "a"); - ASSERT.that(c).has().exactly("a", "a", "b").inOrder(); + assertThat(c).has().exactly("a", "a", "b").inOrder(); } public void testMultisetWrites() { @@ -380,3 +380,4 @@ public class ImmutableMultisetTest extends TestCase { .testEquals(); } } + diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableSetMultimapTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableSetMultimapTest.java index 497a67f67..1b1b5866b 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableSetMultimapTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableSetMultimapTest.java @@ -16,7 +16,7 @@ package com.google.common.collect; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.ImmutableSetMultimap.Builder; @@ -216,10 +216,10 @@ public class ImmutableSetMultimapTest extends TestCase { builder.put("a", 2); builder.put("b", 6); ImmutableSetMultimap<String, Integer> multimap = builder.build(); - ASSERT.that(multimap.keySet()).has().exactly("d", "c", "b", "a").inOrder(); - ASSERT.that(multimap.values()).has().exactly(2, 4, 3, 6, 5, 2).inOrder(); - ASSERT.that(multimap.get("a")).has().exactly(5, 2).inOrder(); - ASSERT.that(multimap.get("b")).has().exactly(3, 6).inOrder(); + assertThat(multimap.keySet()).has().exactly("d", "c", "b", "a").inOrder(); + assertThat(multimap.values()).has().exactly(2, 4, 3, 6, 5, 2).inOrder(); + assertThat(multimap.get("a")).has().exactly(5, 2).inOrder(); + assertThat(multimap.get("b")).has().exactly(3, 6).inOrder(); assertFalse(multimap.get("a") instanceof ImmutableSortedSet); assertFalse(multimap.get("x") instanceof ImmutableSortedSet); assertFalse(multimap.asMap().get("a") instanceof ImmutableSortedSet); @@ -241,10 +241,10 @@ public class ImmutableSetMultimapTest extends TestCase { builder.put("a", 2); builder.put("bb", 6); ImmutableSetMultimap<String, Integer> multimap = builder.build(); - ASSERT.that(multimap.keySet()).has().exactly("d", "a", "bb", "cc").inOrder(); - ASSERT.that(multimap.values()).has().exactly(2, 5, 2, 3, 6, 4).inOrder(); - ASSERT.that(multimap.get("a")).has().exactly(5, 2).inOrder(); - ASSERT.that(multimap.get("bb")).has().exactly(3, 6).inOrder(); + assertThat(multimap.keySet()).has().exactly("d", "a", "bb", "cc").inOrder(); + assertThat(multimap.values()).has().exactly(2, 5, 2, 3, 6, 4).inOrder(); + assertThat(multimap.get("a")).has().exactly(5, 2).inOrder(); + assertThat(multimap.get("bb")).has().exactly(3, 6).inOrder(); assertFalse(multimap.get("a") instanceof ImmutableSortedSet); assertFalse(multimap.get("x") instanceof ImmutableSortedSet); assertFalse(multimap.asMap().get("a") instanceof ImmutableSortedSet); @@ -261,10 +261,10 @@ public class ImmutableSetMultimapTest extends TestCase { builder.put("a", 2); builder.put("b", 6); ImmutableSetMultimap<String, Integer> multimap = builder.build(); - ASSERT.that(multimap.keySet()).has().exactly("b", "d", "a", "c").inOrder(); - ASSERT.that(multimap.values()).has().exactly(6, 3, 2, 5, 2, 4).inOrder(); - ASSERT.that(multimap.get("a")).has().exactly(5, 2).inOrder(); - ASSERT.that(multimap.get("b")).has().exactly(6, 3).inOrder(); + assertThat(multimap.keySet()).has().exactly("b", "d", "a", "c").inOrder(); + assertThat(multimap.values()).has().exactly(6, 3, 2, 5, 2, 4).inOrder(); + assertThat(multimap.get("a")).has().exactly(5, 2).inOrder(); + assertThat(multimap.get("b")).has().exactly(6, 3).inOrder(); assertTrue(multimap.get("a") instanceof ImmutableSortedSet); assertEquals(Collections.reverseOrder(), ((ImmutableSortedSet<Integer>) multimap.get("a")).comparator()); @@ -288,10 +288,10 @@ public class ImmutableSetMultimapTest extends TestCase { builder.put("a", 2); builder.put("b", 6); ImmutableSetMultimap<String, Integer> multimap = builder.build(); - ASSERT.that(multimap.keySet()).has().exactly("d", "c", "b", "a").inOrder(); - ASSERT.that(multimap.values()).has().exactly(2, 4, 6, 3, 5, 2).inOrder(); - ASSERT.that(multimap.get("a")).has().exactly(5, 2).inOrder(); - ASSERT.that(multimap.get("b")).has().exactly(6, 3).inOrder(); + assertThat(multimap.keySet()).has().exactly("d", "c", "b", "a").inOrder(); + assertThat(multimap.values()).has().exactly(2, 4, 6, 3, 5, 2).inOrder(); + assertThat(multimap.get("a")).has().exactly(5, 2).inOrder(); + assertThat(multimap.get("b")).has().exactly(6, 3).inOrder(); assertTrue(multimap.get("a") instanceof ImmutableSortedSet); assertEquals(Collections.reverseOrder(), ((ImmutableSortedSet<Integer>) multimap.get("a")).comparator()); diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableSetTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableSetTest.java index bb71022a8..15cf351fd 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableSetTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableSetTest.java @@ -16,7 +16,7 @@ package com.google.common.collect; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.ImmutableSet.Builder; @@ -103,7 +103,7 @@ public class ImmutableSetTest extends AbstractImmutableSetTest { // now we'll get the varargs overload ImmutableSet<String> set = ImmutableSet.of( "a", "b", "c", "c", "c", "c", "b", "b", "a", "a", "c", "c", "c", "a"); - ASSERT.that(set).has().exactly("a", "b", "c").inOrder(); + assertThat(set).has().exactly("a", "b", "c").inOrder(); } public void testCreation_arrayOfArray() { diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedMapTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedMapTest.java index bb65aafe9..1b76d452e 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedMapTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedMapTest.java @@ -16,7 +16,7 @@ package com.google.common.collect; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Joiner; @@ -611,7 +611,7 @@ public class ImmutableSortedMapTest extends TestCase { public void testHeadMapInclusive() { Map<String, Integer> map = ImmutableSortedMap.of("one", 1, "two", 2, "three", 3).headMap("three", true); - ASSERT.that(map.entrySet()).has().exactly( + assertThat(map.entrySet()).has().exactly( Maps.immutableEntry("one", 1), Maps.immutableEntry("three", 3)).inOrder(); } @@ -620,14 +620,14 @@ public class ImmutableSortedMapTest extends TestCase { public void testHeadMapExclusive() { Map<String, Integer> map = ImmutableSortedMap.of("one", 1, "two", 2, "three", 3).headMap("three", false); - ASSERT.that(map.entrySet()).has().exactly(Maps.immutableEntry("one", 1)).inOrder(); + assertThat(map.entrySet()).has().exactly(Maps.immutableEntry("one", 1)).inOrder(); } @SuppressWarnings("unchecked") // varargs public void testTailMapInclusive() { Map<String, Integer> map = ImmutableSortedMap.of("one", 1, "two", 2, "three", 3).tailMap("three", true); - ASSERT.that(map.entrySet()).has().exactly(Maps.immutableEntry("three", 3), + assertThat(map.entrySet()).has().exactly(Maps.immutableEntry("three", 3), Maps.immutableEntry("two", 2)).inOrder(); } @@ -635,21 +635,21 @@ public class ImmutableSortedMapTest extends TestCase { public void testTailMapExclusive() { Map<String, Integer> map = ImmutableSortedMap.of("one", 1, "two", 2, "three", 3).tailMap("three", false); - ASSERT.that(map.entrySet()).has().exactly(Maps.immutableEntry("two", 2)).inOrder(); + assertThat(map.entrySet()).has().exactly(Maps.immutableEntry("two", 2)).inOrder(); } @SuppressWarnings("unchecked") // varargs public void testSubMapExclusiveExclusive() { Map<String, Integer> map = ImmutableSortedMap.of("one", 1, "two", 2, "three", 3).subMap("one", false, "two", false); - ASSERT.that(map.entrySet()).has().exactly(Maps.immutableEntry("three", 3)).inOrder(); + assertThat(map.entrySet()).has().exactly(Maps.immutableEntry("three", 3)).inOrder(); } @SuppressWarnings("unchecked") // varargs public void testSubMapInclusiveExclusive() { Map<String, Integer> map = ImmutableSortedMap.of("one", 1, "two", 2, "three", 3).subMap("one", true, "two", false); - ASSERT.that(map.entrySet()).has().exactly(Maps.immutableEntry("one", 1), + assertThat(map.entrySet()).has().exactly(Maps.immutableEntry("one", 1), Maps.immutableEntry("three", 3)).inOrder(); } @@ -657,7 +657,7 @@ public class ImmutableSortedMapTest extends TestCase { public void testSubMapExclusiveInclusive() { Map<String, Integer> map = ImmutableSortedMap.of("one", 1, "two", 2, "three", 3).subMap("one", false, "two", true); - ASSERT.that(map.entrySet()).has().exactly(Maps.immutableEntry("three", 3), + assertThat(map.entrySet()).has().exactly(Maps.immutableEntry("three", 3), Maps.immutableEntry("two", 2)).inOrder(); } @@ -665,7 +665,7 @@ public class ImmutableSortedMapTest extends TestCase { public void testSubMapInclusiveInclusive() { Map<String, Integer> map = ImmutableSortedMap.of("one", 1, "two", 2, "three", 3).subMap("one", true, "two", true); - ASSERT.that(map.entrySet()).has().exactly(Maps.immutableEntry("one", 1), + assertThat(map.entrySet()).has().exactly(Maps.immutableEntry("one", 1), Maps.immutableEntry("three", 3), Maps.immutableEntry("two", 2)).inOrder(); } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedSetTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedSetTest.java index aeb3fc089..89d544885 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedSetTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedSetTest.java @@ -16,8 +16,8 @@ package com.google.common.collect; +import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; @@ -145,7 +145,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { public void testSingle_headSet() { SortedSet<String> set = of("e"); assertTrue(set.headSet("g") instanceof ImmutableSortedSet); - ASSERT.that(set.headSet("g")).has().item("e"); + assertThat(set.headSet("g")).has().item("e"); assertSame(of(), set.headSet("c")); assertSame(of(), set.headSet("e")); } @@ -153,16 +153,16 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { public void testSingle_tailSet() { SortedSet<String> set = of("e"); assertTrue(set.tailSet("c") instanceof ImmutableSortedSet); - ASSERT.that(set.tailSet("c")).has().item("e"); - ASSERT.that(set.tailSet("e")).has().item("e"); + assertThat(set.tailSet("c")).has().item("e"); + assertThat(set.tailSet("e")).has().item("e"); assertSame(of(), set.tailSet("g")); } public void testSingle_subSet() { SortedSet<String> set = of("e"); assertTrue(set.subSet("c", "g") instanceof ImmutableSortedSet); - ASSERT.that(set.subSet("c", "g")).has().item("e"); - ASSERT.that(set.subSet("e", "g")).has().item("e"); + assertThat(set.subSet("c", "g")).has().item("e"); + assertThat(set.subSet("e", "g")).has().item("e"); assertSame(of(), set.subSet("f", "g")); assertSame(of(), set.subSet("c", "e")); assertSame(of(), set.subSet("c", "d")); @@ -180,7 +180,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { public void testOf_ordering() { SortedSet<String> set = of("e", "a", "f", "b", "d", "c"); - ASSERT.that(set).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); + assertThat(set).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); } /* @@ -229,7 +229,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { public void testOf_ordering_dupes() { SortedSet<String> set = of("e", "a", "e", "f", "b", "b", "d", "a", "c"); - ASSERT.that(set).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); + assertThat(set).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); } public void testOf_comparator() { @@ -240,8 +240,8 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { public void testOf_headSet() { SortedSet<String> set = of("e", "f", "b", "d", "c"); assertTrue(set.headSet("e") instanceof ImmutableSortedSet); - ASSERT.that(set.headSet("e")).has().exactly("b", "c", "d").inOrder(); - ASSERT.that(set.headSet("g")).has().exactly("b", "c", "d", "e", "f").inOrder(); + assertThat(set.headSet("e")).has().exactly("b", "c", "d").inOrder(); + assertThat(set.headSet("g")).has().exactly("b", "c", "d", "e", "f").inOrder(); assertSame(of(), set.headSet("a")); assertSame(of(), set.headSet("b")); } @@ -249,16 +249,16 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { public void testOf_tailSet() { SortedSet<String> set = of("e", "f", "b", "d", "c"); assertTrue(set.tailSet("e") instanceof ImmutableSortedSet); - ASSERT.that(set.tailSet("e")).has().exactly("e", "f").inOrder(); - ASSERT.that(set.tailSet("a")).has().exactly("b", "c", "d", "e", "f").inOrder(); + assertThat(set.tailSet("e")).has().exactly("e", "f").inOrder(); + assertThat(set.tailSet("a")).has().exactly("b", "c", "d", "e", "f").inOrder(); assertSame(of(), set.tailSet("g")); } public void testOf_subSet() { SortedSet<String> set = of("e", "f", "b", "d", "c"); assertTrue(set.subSet("c", "e") instanceof ImmutableSortedSet); - ASSERT.that(set.subSet("c", "e")).has().exactly("c", "d").inOrder(); - ASSERT.that(set.subSet("a", "g")).has().exactly("b", "c", "d", "e", "f").inOrder(); + assertThat(set.subSet("c", "e")).has().exactly("c", "d").inOrder(); + assertThat(set.subSet("a", "g")).has().exactly("b", "c", "d", "e", "f").inOrder(); assertSame(of(), set.subSet("a", "b")); assertSame(of(), set.subSet("g", "h")); assertSame(of(), set.subSet("c", "c")); @@ -284,14 +284,14 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { public void testExplicit_ordering() { SortedSet<String> set = ImmutableSortedSet.orderedBy(STRING_LENGTH).add( "in", "the", "quick", "jumped", "over", "a").build(); - ASSERT.that(set).has().exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); + assertThat(set).has().exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); } public void testExplicit_ordering_dupes() { SortedSet<String> set = ImmutableSortedSet.orderedBy(STRING_LENGTH).add( "in", "the", "quick", "brown", "fox", "jumped", "over", "a", "lazy", "dog").build(); - ASSERT.that(set).has().exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); + assertThat(set).has().exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); } public void testExplicit_contains() { @@ -321,8 +321,8 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { "in", "the", "quick", "jumped", "over", "a").build(); assertTrue(set.headSet("a") instanceof ImmutableSortedSet); assertTrue(set.headSet("fish") instanceof ImmutableSortedSet); - ASSERT.that(set.headSet("fish")).has().exactly("a", "in", "the").inOrder(); - ASSERT.that(set.headSet("california")).has() + assertThat(set.headSet("fish")).has().exactly("a", "in", "the").inOrder(); + assertThat(set.headSet("california")).has() .exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); assertTrue(set.headSet("a").isEmpty()); assertTrue(set.headSet("").isEmpty()); @@ -333,8 +333,8 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { "in", "the", "quick", "jumped", "over", "a").build(); assertTrue(set.tailSet("california") instanceof ImmutableSortedSet); assertTrue(set.tailSet("fish") instanceof ImmutableSortedSet); - ASSERT.that(set.tailSet("fish")).has().exactly("over", "quick", "jumped").inOrder(); - ASSERT.that( + assertThat(set.tailSet("fish")).has().exactly("over", "quick", "jumped").inOrder(); + assertThat( set.tailSet("a")).has().exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); assertTrue(set.tailSet("california").isEmpty()); } @@ -344,8 +344,8 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { "in", "the", "quick", "jumped", "over", "a").build(); assertTrue(set.subSet("the", "quick") instanceof ImmutableSortedSet); assertTrue(set.subSet("", "b") instanceof ImmutableSortedSet); - ASSERT.that(set.subSet("the", "quick")).has().exactly("the", "over").inOrder(); - ASSERT.that(set.subSet("a", "california")) + assertThat(set.subSet("the", "quick")).has().exactly("the", "over").inOrder(); + assertThat(set.subSet("a", "california")) .has().exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); assertTrue(set.subSet("", "b").isEmpty()); assertTrue(set.subSet("vermont", "california").isEmpty()); @@ -372,13 +372,13 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { public void testCopyOf_ordering() { SortedSet<String> set = copyOf(asList("e", "a", "f", "b", "d", "c")); - ASSERT.that(set).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); + assertThat(set).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); } public void testCopyOf_ordering_dupes() { SortedSet<String> set = copyOf(asList("e", "a", "e", "f", "b", "b", "d", "a", "c")); - ASSERT.that(set).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); + assertThat(set).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); } public void testCopyOf_subSet() { @@ -409,13 +409,13 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { public void testCopyOf_iterator_ordering() { SortedSet<String> set = copyOf(asIterator("e", "a", "f", "b", "d", "c")); - ASSERT.that(set).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); + assertThat(set).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); } public void testCopyOf_iterator_ordering_dupes() { SortedSet<String> set = copyOf(asIterator("e", "a", "e", "f", "b", "b", "d", "a", "c")); - ASSERT.that(set).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); + assertThat(set).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); } public void testCopyOf_iterator_comparator() { @@ -426,7 +426,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { public void testCopyOf_sortedSet_ordering() { SortedSet<String> set = copyOf(Sets.newTreeSet(asList("e", "a", "f", "b", "d", "c"))); - ASSERT.that(set).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); + assertThat(set).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); } public void testCopyOf_sortedSet_comparator() { @@ -438,7 +438,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { SortedSet<String> set = ImmutableSortedSet.copyOf(STRING_LENGTH, asList( "in", "the", "quick", "jumped", "over", "a")); - ASSERT.that(set).has().exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); + assertThat(set).has().exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); } public void testCopyOfExplicit_ordering_dupes() { @@ -446,7 +446,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { ImmutableSortedSet.copyOf(STRING_LENGTH, asList( "in", "the", "quick", "brown", "fox", "jumped", "over", "a", "lazy", "dog")); - ASSERT.that(set).has().exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); + assertThat(set).has().exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); } public void testCopyOfExplicit_comparator() { @@ -460,7 +460,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { SortedSet<String> set = ImmutableSortedSet.copyOf(STRING_LENGTH, asIterator( "in", "the", "quick", "jumped", "over", "a")); - ASSERT.that(set).has().exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); + assertThat(set).has().exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); } public void testCopyOfExplicit_iterator_ordering_dupes() { @@ -468,7 +468,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { ImmutableSortedSet.copyOf(STRING_LENGTH, asIterator( "in", "the", "quick", "brown", "fox", "jumped", "over", "a", "lazy", "dog")); - ASSERT.that(set).has().exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); + assertThat(set).has().exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); } public void testCopyOfExplicit_iterator_comparator() { @@ -482,14 +482,14 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { SortedSet<String> input = Sets.newTreeSet(STRING_LENGTH); Collections.addAll(input, "in", "the", "quick", "jumped", "over", "a"); SortedSet<String> set = copyOf(input); - ASSERT.that(set).has().exactly("a", "in", "jumped", "over", "quick", "the").inOrder(); + assertThat(set).has().exactly("a", "in", "jumped", "over", "quick", "the").inOrder(); } public void testCopyOfSorted_natural_ordering() { SortedSet<String> input = Sets.newTreeSet( asList("in", "the", "quick", "jumped", "over", "a")); SortedSet<String> set = ImmutableSortedSet.copyOfSorted(input); - ASSERT.that(set).has().exactly("a", "in", "jumped", "over", "quick", "the").inOrder(); + assertThat(set).has().exactly("a", "in", "jumped", "over", "quick", "the").inOrder(); } public void testCopyOfSorted_natural_comparator() { @@ -503,7 +503,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { SortedSet<String> input = Sets.newTreeSet(STRING_LENGTH); Collections.addAll(input, "in", "the", "quick", "jumped", "over", "a"); SortedSet<String> set = ImmutableSortedSet.copyOfSorted(input); - ASSERT.that(set).has().exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); + assertThat(set).has().exactly("a", "in", "the", "over", "quick", "jumped").inOrder(); assertSame(STRING_LENGTH, set.comparator()); } @@ -591,7 +591,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { public void testReverseOrder() { SortedSet<String> set = ImmutableSortedSet.<String>reverseOrder() .add("a", "b", "c").build(); - ASSERT.that(set).has().exactly("c", "b", "a").inOrder(); + assertThat(set).has().exactly("c", "b", "a").inOrder(); assertEquals(Ordering.natural().reverse(), set.comparator()); } @@ -606,13 +606,13 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { public void testSupertypeComparator() { SortedSet<Integer> set = new ImmutableSortedSet.Builder<Integer>(TO_STRING) .add(3, 12, 101, 44).build(); - ASSERT.that(set).has().exactly(101, 12, 3, 44).inOrder(); + assertThat(set).has().exactly(101, 12, 3, 44).inOrder(); } public void testSupertypeComparatorSubtypeElements() { SortedSet<Number> set = new ImmutableSortedSet.Builder<Number>(TO_STRING) .add(3, 12, 101, 44).build(); - ASSERT.that(set).has().exactly(101, 12, 3, 44).inOrder(); + assertThat(set).has().exactly(101, 12, 3, 44).inOrder(); } @Override <E extends Comparable<E>> ImmutableSortedSet.Builder<E> builder() { @@ -724,7 +724,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { private static void assertNotEqualLenient( TreeSet<?> unexpected, SortedSet<?> actual) { try { - ASSERT.that(actual).isNotEqualTo(unexpected); + assertThat(actual).isNotEqualTo(unexpected); } catch (ClassCastException accepted) { } } @@ -734,7 +734,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { ImmutableSortedSet<String> set = ImmutableSortedSet.copyOf(strings); Arrays.sort(strings); for (int i = 0; i < strings.length; i++) { - ASSERT.that(set.headSet(strings[i], true)) + assertThat(set.headSet(strings[i], true)) .has().exactlyAs(sortedNumberNames(0, i + 1)).inOrder(); } } @@ -744,7 +744,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { ImmutableSortedSet<String> set = ImmutableSortedSet.copyOf(strings); Arrays.sort(strings); for (int i = 0; i < strings.length; i++) { - ASSERT.that(set.headSet(strings[i], false)).has().exactlyAs( + assertThat(set.headSet(strings[i], false)).has().exactlyAs( sortedNumberNames(0, i)).inOrder(); } } @@ -754,7 +754,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { ImmutableSortedSet<String> set = ImmutableSortedSet.copyOf(strings); Arrays.sort(strings); for (int i = 0; i < strings.length; i++) { - ASSERT.that(set.tailSet(strings[i], true)).has().exactlyAs( + assertThat(set.tailSet(strings[i], true)).has().exactlyAs( sortedNumberNames(i, strings.length)).inOrder(); } } @@ -764,7 +764,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { ImmutableSortedSet<String> set = ImmutableSortedSet.copyOf(strings); Arrays.sort(strings); for (int i = 0; i < strings.length; i++) { - ASSERT.that(set.tailSet(strings[i], false)).has().exactlyAs( + assertThat(set.tailSet(strings[i], false)).has().exactlyAs( sortedNumberNames(i + 1, strings.length)).inOrder(); } } @@ -775,7 +775,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { Arrays.sort(strings); for (int i = 0; i < strings.length; i++) { for (int j = i; j < strings.length; j++) { - ASSERT.that(set.subSet(strings[i], false, strings[j], false)) + assertThat(set.subSet(strings[i], false, strings[j], false)) .has().exactlyAs(sortedNumberNames(Math.min(i + 1, j), j)).inOrder(); } } @@ -787,7 +787,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { Arrays.sort(strings); for (int i = 0; i < strings.length; i++) { for (int j = i; j < strings.length; j++) { - ASSERT.that(set.subSet(strings[i], true, strings[j], false)) + assertThat(set.subSet(strings[i], true, strings[j], false)) .has().exactlyAs(sortedNumberNames(i, j)).inOrder(); } } @@ -799,7 +799,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { Arrays.sort(strings); for (int i = 0; i < strings.length; i++) { for (int j = i; j < strings.length; j++) { - ASSERT.that(set.subSet(strings[i], false, strings[j], true)) + assertThat(set.subSet(strings[i], false, strings[j], true)) .has().exactlyAs(sortedNumberNames(i + 1, j + 1)).inOrder(); } } @@ -811,7 +811,7 @@ public class ImmutableSortedSetTest extends AbstractImmutableSetTest { Arrays.sort(strings); for (int i = 0; i < strings.length; i++) { for (int j = i; j < strings.length; j++) { - ASSERT.that(set.subSet(strings[i], true, strings[j], true)) + assertThat(set.subSet(strings[i], true, strings[j], true)) .has().exactlyAs(sortedNumberNames(i, j + 1)).inOrder(); } } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableTableTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableTableTest.java index e067e7e16..c602d653c 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableTableTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ImmutableTableTest.java @@ -16,7 +16,7 @@ package com.google.common.collect; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; @@ -184,8 +184,8 @@ public class ImmutableTableTest extends AbstractTableReadTest { validateTableCopies(table); // Even though rowKeySet, columnKeySet, and cellSet have the same // iteration ordering, row has an inconsistent ordering. - ASSERT.that(table.row('b').keySet()).has().exactly(1, 2).inOrder(); - ASSERT.that(ImmutableTable.copyOf(table).row('b').keySet()) + assertThat(table.row('b').keySet()).has().exactly(1, 2).inOrder(); + assertThat(ImmutableTable.copyOf(table).row('b').keySet()) .has().exactly(2, 1).inOrder(); } @@ -227,10 +227,10 @@ public class ImmutableTableTest extends AbstractTableReadTest { = builder.orderRowsBy(Ordering.natural()) .orderColumnsBy(Ordering.natural()) .putAll(table).build(); - ASSERT.that(copy.rowKeySet()).has().exactly('a', 'b').inOrder(); - ASSERT.that(copy.columnKeySet()).has().exactly(1, 2).inOrder(); - ASSERT.that(copy.values()).has().exactly("baz", "bar", "foo").inOrder(); - ASSERT.that(copy.row('b').keySet()).has().exactly(1, 2).inOrder(); + assertThat(copy.rowKeySet()).has().exactly('a', 'b').inOrder(); + assertThat(copy.columnKeySet()).has().exactly(1, 2).inOrder(); + assertThat(copy.values()).has().exactly("baz", "bar", "foo").inOrder(); + assertThat(copy.row('b').keySet()).has().exactly(1, 2).inOrder(); } public void testBuilder_orderRowsAndColumnsBy_sparse() { @@ -248,12 +248,12 @@ public class ImmutableTableTest extends AbstractTableReadTest { builder.put('r', 4, "foo"); builder.put('x', 5, "bar"); Table<Character, Integer, String> table = builder.build(); - ASSERT.that(table.rowKeySet()).has().exactly('b', 'c', 'e', 'r', 'x').inOrder(); - ASSERT.that(table.columnKeySet()).has().exactly(0, 1, 2, 3, 4, 5, 7).inOrder(); - ASSERT.that(table.values()).has().exactly("cat", "axe", "baz", "tub", + assertThat(table.rowKeySet()).has().exactly('b', 'c', 'e', 'r', 'x').inOrder(); + assertThat(table.columnKeySet()).has().exactly(0, 1, 2, 3, 4, 5, 7).inOrder(); + assertThat(table.values()).has().exactly("cat", "axe", "baz", "tub", "dog", "bar", "foo", "foo", "bar").inOrder(); - ASSERT.that(table.row('c').keySet()).has().exactly(0, 3).inOrder(); - ASSERT.that(table.column(5).keySet()).has().exactly('e', 'x').inOrder(); + assertThat(table.row('c').keySet()).has().exactly(0, 3).inOrder(); + assertThat(table.column(5).keySet()).has().exactly('e', 'x').inOrder(); } public void testBuilder_orderRowsAndColumnsBy_dense() { @@ -270,12 +270,12 @@ public class ImmutableTableTest extends AbstractTableReadTest { builder.put('a', 2, "bar"); builder.put('a', 1, "baz"); Table<Character, Integer, String> table = builder.build(); - ASSERT.that(table.rowKeySet()).has().exactly('a', 'b', 'c').inOrder(); - ASSERT.that(table.columnKeySet()).has().exactly(1, 2, 3).inOrder(); - ASSERT.that(table.values()).has().exactly("baz", "bar", "foo", "dog", + assertThat(table.rowKeySet()).has().exactly('a', 'b', 'c').inOrder(); + assertThat(table.columnKeySet()).has().exactly(1, 2, 3).inOrder(); + assertThat(table.values()).has().exactly("baz", "bar", "foo", "dog", "cat", "baz", "bar", "foo").inOrder(); - ASSERT.that(table.row('c').keySet()).has().exactly(1, 2, 3).inOrder(); - ASSERT.that(table.column(1).keySet()).has().exactly('a', 'b', 'c').inOrder(); + assertThat(table.row('c').keySet()).has().exactly(1, 2, 3).inOrder(); + assertThat(table.column(1).keySet()).has().exactly('a', 'b', 'c').inOrder(); } public void testBuilder_orderRowsBy_sparse() { @@ -292,8 +292,8 @@ public class ImmutableTableTest extends AbstractTableReadTest { builder.put('r', 4, "foo"); builder.put('x', 5, "bar"); Table<Character, Integer, String> table = builder.build(); - ASSERT.that(table.rowKeySet()).has().exactly('b', 'c', 'e', 'r', 'x').inOrder(); - ASSERT.that(table.column(5).keySet()).has().exactly('e', 'x').inOrder(); + assertThat(table.rowKeySet()).has().exactly('b', 'c', 'e', 'r', 'x').inOrder(); + assertThat(table.column(5).keySet()).has().exactly('e', 'x').inOrder(); } public void testBuilder_orderRowsBy_dense() { @@ -309,8 +309,8 @@ public class ImmutableTableTest extends AbstractTableReadTest { builder.put('a', 2, "bar"); builder.put('a', 1, "baz"); Table<Character, Integer, String> table = builder.build(); - ASSERT.that(table.rowKeySet()).has().exactly('a', 'b', 'c').inOrder(); - ASSERT.that(table.column(1).keySet()).has().exactly('a', 'b', 'c').inOrder(); + assertThat(table.rowKeySet()).has().exactly('a', 'b', 'c').inOrder(); + assertThat(table.column(1).keySet()).has().exactly('a', 'b', 'c').inOrder(); } public void testBuilder_orderColumnsBy_sparse() { @@ -327,8 +327,8 @@ public class ImmutableTableTest extends AbstractTableReadTest { builder.put('r', 4, "foo"); builder.put('x', 5, "bar"); Table<Character, Integer, String> table = builder.build(); - ASSERT.that(table.columnKeySet()).has().exactly(0, 1, 2, 3, 4, 5, 7).inOrder(); - ASSERT.that(table.row('c').keySet()).has().exactly(0, 3).inOrder(); + assertThat(table.columnKeySet()).has().exactly(0, 1, 2, 3, 4, 5, 7).inOrder(); + assertThat(table.row('c').keySet()).has().exactly(0, 3).inOrder(); } public void testBuilder_orderColumnsBy_dense() { @@ -344,8 +344,8 @@ public class ImmutableTableTest extends AbstractTableReadTest { builder.put('a', 2, "bar"); builder.put('a', 1, "baz"); Table<Character, Integer, String> table = builder.build(); - ASSERT.that(table.columnKeySet()).has().exactly(1, 2, 3).inOrder(); - ASSERT.that(table.row('c').keySet()).has().exactly(1, 2, 3).inOrder(); + assertThat(table.columnKeySet()).has().exactly(1, 2, 3).inOrder(); + assertThat(table.row('c').keySet()).has().exactly(1, 2, 3).inOrder(); } } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/IterablesTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/IterablesTest.java index 8ee393e40..5d0b304fc 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/IterablesTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/IterablesTest.java @@ -20,9 +20,9 @@ import static com.google.common.collect.Iterables.skip; import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Sets.newLinkedHashSet; import static com.google.common.collect.testing.IteratorFeature.UNMODIFIABLE; +import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; import static java.util.Collections.emptyList; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Function; @@ -374,7 +374,7 @@ public class IterablesTest extends TestCase { int n = 4; Iterable<Integer> repeated = Iterables.concat(Collections.nCopies(n, iterable)); - ASSERT.that(repeated).iteratesOverSequence( + assertThat(repeated).iteratesAs( 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3); } @@ -451,7 +451,7 @@ public class IterablesTest extends TestCase { List<String> freshlyAdded = newArrayList("freshly", "added"); boolean changed = Iterables.addAll(alreadyThere, freshlyAdded); - ASSERT.that(alreadyThere).has().exactly( + assertThat(alreadyThere).has().exactly( "already", "there", "freshly", "added").inOrder(); assertTrue(changed); } @@ -603,7 +603,7 @@ public class IterablesTest extends TestCase { Iterable<String> tail = skip(set, 1); set.remove("b"); set.addAll(newArrayList("A", "B", "C")); - ASSERT.that(tail).iteratesOverSequence("c", "A", "B", "C"); + assertThat(tail).iteratesAs("c", "A", "B", "C"); } public void testSkip_structurallyModifiedSkipSomeList() throws Exception { @@ -611,7 +611,7 @@ public class IterablesTest extends TestCase { Iterable<String> tail = skip(list, 1); list.subList(1, 3).clear(); list.addAll(0, newArrayList("A", "B", "C")); - ASSERT.that(tail).iteratesOverSequence("B", "C", "a"); + assertThat(tail).iteratesAs("B", "C", "a"); } public void testSkip_structurallyModifiedSkipAll() throws Exception { @@ -1042,16 +1042,16 @@ public class IterablesTest extends TestCase { assertEquals("Iterables.consumingIterable(...)", consumingIterable.toString()); Iterator<String> consumingIterator = consumingIterable.iterator(); - ASSERT.that(list).has().exactly("a", "b").inOrder(); + assertThat(list).has().exactly("a", "b").inOrder(); assertTrue(consumingIterator.hasNext()); - ASSERT.that(list).has().exactly("a", "b").inOrder(); + assertThat(list).has().exactly("a", "b").inOrder(); assertEquals("a", consumingIterator.next()); - ASSERT.that(list).has().item("b"); + assertThat(list).has().item("b"); assertTrue(consumingIterator.hasNext()); assertEquals("b", consumingIterator.next()); - ASSERT.that(list).isEmpty(); + assertThat(list).isEmpty(); assertFalse(consumingIterator.hasNext()); } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/IteratorsTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/IteratorsTest.java index d515fba35..38bb635cc 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/IteratorsTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/IteratorsTest.java @@ -20,8 +20,8 @@ import static com.google.common.collect.Iterators.advance; import static com.google.common.collect.Iterators.get; import static com.google.common.collect.Iterators.getLast; import static com.google.common.collect.Lists.newArrayList; +import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Function; @@ -613,7 +613,7 @@ public class IteratorsTest extends TestCase { boolean changed = Iterators.addAll(alreadyThere, Iterators.<String>emptyIterator()); - ASSERT.that(alreadyThere).has().exactly("already", "there").inOrder(); + assertThat(alreadyThere).has().exactly("already", "there").inOrder(); assertFalse(changed); } @@ -623,7 +623,7 @@ public class IteratorsTest extends TestCase { boolean changed = Iterators.addAll(alreadyThere, freshlyAdded.iterator()); - ASSERT.that(alreadyThere).has().exactly("already", "there", "freshly", "added"); + assertThat(alreadyThere).has().exactly("already", "there", "freshly", "added"); assertTrue(changed); } @@ -633,7 +633,7 @@ public class IteratorsTest extends TestCase { List<String> oneMore = Lists.newArrayList("there"); boolean changed = Iterators.addAll(alreadyThere, oneMore.iterator()); - ASSERT.that(alreadyThere).has().exactly("already", "there").inOrder(); + assertThat(alreadyThere).has().exactly("already", "there").inOrder(); assertFalse(changed); } @@ -1229,16 +1229,16 @@ public class IteratorsTest extends TestCase { assertEquals("Iterators.consumingIterator(...)", consumingIterator.toString()); - ASSERT.that(list).has().exactly("a", "b").inOrder(); + assertThat(list).has().exactly("a", "b").inOrder(); assertTrue(consumingIterator.hasNext()); - ASSERT.that(list).has().exactly("a", "b").inOrder(); + assertThat(list).has().exactly("a", "b").inOrder(); assertEquals("a", consumingIterator.next()); - ASSERT.that(list).has().item("b"); + assertThat(list).has().item("b"); assertTrue(consumingIterator.hasNext()); assertEquals("b", consumingIterator.next()); - ASSERT.that(list).isEmpty(); + assertThat(list).isEmpty(); assertFalse(consumingIterator.hasNext()); } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/LinkedHashMultimapTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/LinkedHashMultimapTest.java index 81e68c067..05d66509e 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/LinkedHashMultimapTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/LinkedHashMultimapTest.java @@ -16,8 +16,8 @@ package com.google.common.collect; +import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; import com.google.common.testing.EqualsTester; @@ -88,12 +88,12 @@ public class LinkedHashMultimapTest extends TestCase { } private void assertOrderingReadOnly(Multimap<String, Integer> multimap) { - ASSERT.that(multimap.get("foo")).has().exactly(5, 3).inOrder(); - ASSERT.that(multimap.get("bar")).has().exactly(4, 1).inOrder(); - ASSERT.that(multimap.get("cow")).has().item(2); + assertThat(multimap.get("foo")).has().exactly(5, 3).inOrder(); + assertThat(multimap.get("bar")).has().exactly(4, 1).inOrder(); + assertThat(multimap.get("cow")).has().item(2); - ASSERT.that(multimap.keySet()).has().exactly("foo", "bar", "cow").inOrder(); - ASSERT.that(multimap.values()).has().exactly(5, 4, 3, 2, 1).inOrder(); + assertThat(multimap.keySet()).has().exactly("foo", "bar", "cow").inOrder(); + assertThat(multimap.values()).has().exactly(5, 4, 3, 2, 1).inOrder(); Iterator<Map.Entry<String, Integer>> entryIterator = multimap.entries().iterator(); @@ -107,28 +107,28 @@ public class LinkedHashMultimapTest extends TestCase { multimap.asMap().entrySet().iterator(); Map.Entry<String, Collection<Integer>> entry = collectionIterator.next(); assertEquals("foo", entry.getKey()); - ASSERT.that(entry.getValue()).has().exactly(5, 3).inOrder(); + assertThat(entry.getValue()).has().exactly(5, 3).inOrder(); entry = collectionIterator.next(); assertEquals("bar", entry.getKey()); - ASSERT.that(entry.getValue()).has().exactly(4, 1).inOrder(); + assertThat(entry.getValue()).has().exactly(4, 1).inOrder(); entry = collectionIterator.next(); assertEquals("cow", entry.getKey()); - ASSERT.that(entry.getValue()).has().item(2); + assertThat(entry.getValue()).has().item(2); } public void testOrderingUpdates() { Multimap<String, Integer> multimap = initializeMultimap5(); - ASSERT.that(multimap.replaceValues("foo", asList(6, 7))).has().exactly(5, 3).inOrder(); - ASSERT.that(multimap.keySet()).has().exactly("foo", "bar", "cow").inOrder(); - ASSERT.that(multimap.removeAll("foo")).has().exactly(6, 7).inOrder(); - ASSERT.that(multimap.keySet()).has().exactly("bar", "cow").inOrder(); + assertThat(multimap.replaceValues("foo", asList(6, 7))).has().exactly(5, 3).inOrder(); + assertThat(multimap.keySet()).has().exactly("foo", "bar", "cow").inOrder(); + assertThat(multimap.removeAll("foo")).has().exactly(6, 7).inOrder(); + assertThat(multimap.keySet()).has().exactly("bar", "cow").inOrder(); assertTrue(multimap.remove("bar", 4)); - ASSERT.that(multimap.keySet()).has().exactly("bar", "cow").inOrder(); + assertThat(multimap.keySet()).has().exactly("bar", "cow").inOrder(); assertTrue(multimap.remove("bar", 1)); - ASSERT.that(multimap.keySet()).has().item("cow"); + assertThat(multimap.keySet()).has().item("cow"); multimap.put("bar", 9); - ASSERT.that(multimap.keySet()).has().exactly("cow", "bar").inOrder(); + assertThat(multimap.keySet()).has().exactly("cow", "bar").inOrder(); } public void testToStringNullExact() { diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/LinkedHashMultisetTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/LinkedHashMultisetTest.java index 4dc51a676..bfab499bf 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/LinkedHashMultisetTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/LinkedHashMultisetTest.java @@ -16,8 +16,8 @@ package com.google.common.collect; +import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.google.TestStringMultisetGenerator; @@ -97,14 +97,14 @@ public class LinkedHashMultisetTest extends TestCase { ms.add("a"); ms.add("b", 2); ms.add("c"); - ASSERT.that(ms.elementSet()).has().exactly("a", "b", "c").inOrder(); + assertThat(ms.elementSet()).has().exactly("a", "b", "c").inOrder(); ms.remove("b"); - ASSERT.that(ms.elementSet()).has().exactly("a", "b", "c").inOrder(); + assertThat(ms.elementSet()).has().exactly("a", "b", "c").inOrder(); ms.add("b"); - ASSERT.that(ms.elementSet()).has().exactly("a", "b", "c").inOrder(); + assertThat(ms.elementSet()).has().exactly("a", "b", "c").inOrder(); ms.remove("b", 2); ms.add("b"); - ASSERT.that(ms.elementSet()).has().exactly("a", "c", "b").inOrder(); + assertThat(ms.elementSet()).has().exactly("a", "c", "b").inOrder(); } } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/LinkedListMultimapTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/LinkedListMultimapTest.java index 27a4c66ed..469b1b67d 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/LinkedListMultimapTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/LinkedListMultimapTest.java @@ -16,8 +16,8 @@ package com.google.common.collect; +import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; import com.google.common.testing.EqualsTester; @@ -89,7 +89,7 @@ public class LinkedListMultimapTest extends TestCase { LinkedListMultimap<String, Integer> copy = LinkedListMultimap.create(multimap); assertEquals(multimap, copy); - ASSERT.that(copy.entries()).has().exactlyAs(multimap.entries()).inOrder(); + assertThat(copy.entries()).has().exactlyAs(multimap.entries()).inOrder(); } public void testCreateFromSize() { @@ -183,10 +183,10 @@ public class LinkedListMultimapTest extends TestCase { List<Integer> foos = map.get("foo"); Collection<Integer> values = map.values(); assertEquals(asList(1, 2), foos); - ASSERT.that(values).has().exactly(1, 2, 3).inOrder(); + assertThat(values).has().exactly(1, 2, 3).inOrder(); map.clear(); assertEquals(Collections.emptyList(), foos); - ASSERT.that(values).isEmpty(); + assertThat(values).isEmpty(); assertEquals("[]", map.entries().toString()); assertEquals("{}", map.toString()); } @@ -210,7 +210,7 @@ public class LinkedListMultimapTest extends TestCase { map.put("bar", 4); assertEquals("[bar=1, foo=2, bar=3, bar=4]", map.entries().toString()); - ASSERT.that(map.keys()).has().exactly("bar", "foo", "bar", "bar").inOrder(); + assertThat(map.keys()).has().exactly("bar", "foo", "bar", "bar").inOrder(); map.keys().remove("bar"); // bar is no longer the first key! assertEquals("{foo=[2], bar=[3, 4]}", map.toString()); } @@ -256,7 +256,7 @@ public class LinkedListMultimapTest extends TestCase { = map.asMap().entrySet().iterator(); Map.Entry<String, Collection<Integer>> entry = entries.next(); assertEquals("bar", entry.getKey()); - ASSERT.that(entry.getValue()).has().exactly(1, 3).inOrder(); + assertThat(entry.getValue()).has().exactly(1, 3).inOrder(); try { entry.setValue(Arrays.<Integer>asList()); fail("UnsupportedOperationException expected"); @@ -264,7 +264,7 @@ public class LinkedListMultimapTest extends TestCase { entries.remove(); // clear entry = entries.next(); assertEquals("foo", entry.getKey()); - ASSERT.that(entry.getValue()).has().item(2); + assertThat(entry.getValue()).has().item(2); assertFalse(entries.hasNext()); assertEquals("{foo=[2]}", map.toString()); } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ListsTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ListsTest.java index 2ec35ce59..dcd52d594 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ListsTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ListsTest.java @@ -17,9 +17,9 @@ package com.google.common.collect; import static com.google.common.collect.testing.IteratorFeature.UNMODIFIABLE; +import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Function; @@ -214,7 +214,7 @@ public class ListsTest extends TestCase { } private void checkFooBarBazList(List<String> list) { - ASSERT.that(list).has().exactly("foo", "bar", "baz").inOrder(); + assertThat(list).has().exactly("foo", "bar", "baz").inOrder(); assertEquals(3, list.size()); assertIndexIsOutOfBounds(list, -1); assertEquals("foo", list.get(0)); @@ -225,7 +225,7 @@ public class ListsTest extends TestCase { public void testAsList1Small() { List<String> list = Lists.asList("foo", new String[0]); - ASSERT.that(list).has().item("foo"); + assertThat(list).has().item("foo"); assertEquals(1, list.size()); assertIndexIsOutOfBounds(list, -1); assertEquals("foo", list.get(0)); @@ -308,24 +308,24 @@ public class ListsTest extends TestCase { @SuppressWarnings("unchecked") // varargs! public void testCartesianProduct_binary1x1() { - ASSERT.that(Lists.cartesianProduct(list(1), list(2))).has().item(list(1, 2)); + assertThat(Lists.cartesianProduct(list(1), list(2))).has().item(list(1, 2)); } @SuppressWarnings("unchecked") // varargs! public void testCartesianProduct_binary1x2() { - ASSERT.that(Lists.cartesianProduct(list(1), list(2, 3))) + assertThat(Lists.cartesianProduct(list(1), list(2, 3))) .has().exactly(list(1, 2), list(1, 3)).inOrder(); } @SuppressWarnings("unchecked") // varargs! public void testCartesianProduct_binary2x2() { - ASSERT.that(Lists.cartesianProduct(list(1, 2), list(3, 4))) + assertThat(Lists.cartesianProduct(list(1, 2), list(3, 4))) .has().exactly(list(1, 3), list(1, 4), list(2, 3), list(2, 4)).inOrder(); } @SuppressWarnings("unchecked") // varargs! public void testCartesianProduct_2x2x2() { - ASSERT.that(Lists.cartesianProduct(list(0, 1), list(0, 1), list(0, 1))).has().exactly( + assertThat(Lists.cartesianProduct(list(0, 1), list(0, 1), list(0, 1))).has().exactly( list(0, 0, 0), list(0, 0, 1), list(0, 1, 0), list(0, 1, 1), list(1, 0, 0), list(1, 0, 1), list(1, 1, 0), list(1, 1, 1)).inOrder(); } @@ -350,7 +350,7 @@ public class ListsTest extends TestCase { List<Object> exp3 = list((Object) 2, "3"); List<Object> exp4 = list((Object) 2, "4"); - ASSERT.that(Lists.<Object>cartesianProduct(x, y)) + assertThat(Lists.<Object>cartesianProduct(x, y)) .has().exactly(exp1, exp2, exp3, exp4).inOrder(); } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MapConstraintsTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MapConstraintsTest.java index c199fdd34..928f809a8 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MapConstraintsTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MapConstraintsTest.java @@ -17,7 +17,7 @@ package com.google.common.collect; import static com.google.common.collect.testing.Helpers.nefariousMapEntry; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Supplier; @@ -113,7 +113,7 @@ public class MapConstraintsTest extends TestCase { assertFalse(map.values() instanceof Serializable); assertEquals(map.toString(), constrained.toString()); assertEquals(map.hashCode(), constrained.hashCode()); - ASSERT.that(map.entrySet()).has().exactly( + assertThat(map.entrySet()).has().exactly( Maps.immutableEntry(TEST_KEY, TEST_VALUE), Maps.immutableEntry("foo", 1), Maps.immutableEntry("bar", 2), @@ -161,7 +161,7 @@ public class MapConstraintsTest extends TestCase { assertEquals(map.values(), constrained.values()); assertEquals(map.toString(), constrained.toString()); assertEquals(map.hashCode(), constrained.hashCode()); - ASSERT.that(map.entrySet()).has().exactly( + assertThat(map.entrySet()).has().exactly( Maps.immutableEntry(TEST_KEY, TEST_VALUE), Maps.immutableEntry("foo", 1), Maps.immutableEntry("bar", 2), @@ -228,9 +228,9 @@ public class MapConstraintsTest extends TestCase { .put("dag", 11).build()); assertTrue(multimap.equals(constrained)); assertTrue(constrained.equals(multimap)); - ASSERT.that(ImmutableList.copyOf(multimap.entries())) - .is(ImmutableList.copyOf(constrained.entries())); - ASSERT.that(constrained.asMap().get("foo")).has().item(1); + assertThat(ImmutableList.copyOf(multimap.entries())).isEqualTo( + ImmutableList.copyOf(constrained.entries())); + assertThat(constrained.asMap().get("foo")).has().item(1); assertNull(constrained.asMap().get("missing")); assertEquals(multimap.asMap(), constrained.asMap()); assertEquals(multimap.values(), constrained.values()); @@ -238,7 +238,7 @@ public class MapConstraintsTest extends TestCase { assertEquals(multimap.keySet(), constrained.keySet()); assertEquals(multimap.toString(), constrained.toString()); assertEquals(multimap.hashCode(), constrained.hashCode()); - ASSERT.that(multimap.entries()).has().exactly( + assertThat(multimap.entries()).has().exactly( Maps.immutableEntry(TEST_KEY, TEST_VALUE), Maps.immutableEntry("foo", 1), Maps.immutableEntry("bar", 2), @@ -405,8 +405,8 @@ public class MapConstraintsTest extends TestCase { .add(TEST_VALUE); fail("TestValueException expected"); } catch (TestValueException expected) {} - ASSERT.that(ImmutableList.copyOf(multimap.entries())) - .is(ImmutableList.copyOf(constrained.entries())); + assertThat(ImmutableList.copyOf(multimap.entries())).isEqualTo( + ImmutableList.copyOf(constrained.entries())); assertEquals(multimap.asMap(), constrained.asMap()); assertEquals(multimap.values(), constrained.values()); assertEquals(multimap.keys(), constrained.keys()); diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MapsTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MapsTest.java index 63e62fc5a..f2b35388c 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MapsTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MapsTest.java @@ -19,7 +19,7 @@ package com.google.common.collect; import static com.google.common.collect.Maps.transformEntries; import static com.google.common.collect.Maps.transformValues; import static com.google.common.collect.testing.Helpers.mapEntry; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Converter; @@ -183,9 +183,9 @@ public class MapsTest extends TestCase { assertEquals(Collections.emptyMap(), map); map.put(new Derived("foo"), 1); map.put(new Derived("bar"), 2); - ASSERT.that(map.keySet()).has().exactly( + assertThat(map.keySet()).has().exactly( new Derived("bar"), new Derived("foo")).inOrder(); - ASSERT.that(map.values()).has().exactly(2, 1).inOrder(); + assertThat(map.values()).has().exactly(2, 1).inOrder(); assertNull(map.comparator()); } @@ -194,9 +194,9 @@ public class MapsTest extends TestCase { assertEquals(Collections.emptyMap(), map); map.put(new LegacyComparable("foo"), 1); map.put(new LegacyComparable("bar"), 2); - ASSERT.that(map.keySet()).has().exactly( + assertThat(map.keySet()).has().exactly( new LegacyComparable("bar"), new LegacyComparable("foo")).inOrder(); - ASSERT.that(map.values()).has().exactly(2, 1).inOrder(); + assertThat(map.values()).has().exactly(2, 1).inOrder(); assertNull(map.comparator()); } @@ -460,13 +460,13 @@ public class MapsTest extends TestCase { SortedMapDifference<Integer, String> diff1 = Maps.difference(left, right); assertFalse(diff1.areEqual()); - ASSERT.that(diff1.entriesOnlyOnLeft().entrySet()).has().exactly( + assertThat(diff1.entriesOnlyOnLeft().entrySet()).has().exactly( Maps.immutableEntry(4, "d"), Maps.immutableEntry(2, "b")).inOrder(); - ASSERT.that(diff1.entriesOnlyOnRight().entrySet()).has().item( + assertThat(diff1.entriesOnlyOnRight().entrySet()).has().item( Maps.immutableEntry(6, "z")); - ASSERT.that(diff1.entriesInCommon().entrySet()).has().item( + assertThat(diff1.entriesInCommon().entrySet()).has().item( Maps.immutableEntry(1, "a")); - ASSERT.that(diff1.entriesDiffering().entrySet()).has().exactly( + assertThat(diff1.entriesDiffering().entrySet()).has().exactly( Maps.immutableEntry(5, ValueDifferenceImpl.create("e", "g")), Maps.immutableEntry(3, ValueDifferenceImpl.create("c", "f"))).inOrder(); assertEquals("not equal: only on left={4=d, 2=b}: only on right={6=z}: " @@ -475,11 +475,11 @@ public class MapsTest extends TestCase { SortedMapDifference<Integer, String> diff2 = Maps.difference(right, left); assertFalse(diff2.areEqual()); - ASSERT.that(diff2.entriesOnlyOnLeft().entrySet()).has().item( + assertThat(diff2.entriesOnlyOnLeft().entrySet()).has().item( Maps.immutableEntry(6, "z")); - ASSERT.that(diff2.entriesOnlyOnRight().entrySet()).has().exactly( + assertThat(diff2.entriesOnlyOnRight().entrySet()).has().exactly( Maps.immutableEntry(2, "b"), Maps.immutableEntry(4, "d")).inOrder(); - ASSERT.that(diff1.entriesInCommon().entrySet()).has().item( + assertThat(diff1.entriesInCommon().entrySet()).has().item( Maps.immutableEntry(1, "a")); assertEquals(ImmutableMap.of( 3, ValueDifferenceImpl.create("f", "c"), @@ -499,13 +499,13 @@ public class MapsTest extends TestCase { Maps.difference(left, right); left.put(6, "z"); assertFalse(diff1.areEqual()); - ASSERT.that(diff1.entriesOnlyOnLeft().entrySet()).has().exactly( + assertThat(diff1.entriesOnlyOnLeft().entrySet()).has().exactly( Maps.immutableEntry(2, "b"), Maps.immutableEntry(4, "d")).inOrder(); - ASSERT.that(diff1.entriesOnlyOnRight().entrySet()).has().item( + assertThat(diff1.entriesOnlyOnRight().entrySet()).has().item( Maps.immutableEntry(6, "z")); - ASSERT.that(diff1.entriesInCommon().entrySet()).has().item( + assertThat(diff1.entriesInCommon().entrySet()).has().item( Maps.immutableEntry(1, "a")); - ASSERT.that(diff1.entriesDiffering().entrySet()).has().exactly( + assertThat(diff1.entriesDiffering().entrySet()).has().exactly( Maps.immutableEntry(3, ValueDifferenceImpl.create("c", "f")), Maps.immutableEntry(5, ValueDifferenceImpl.create("e", "g"))).inOrder(); try { @@ -562,7 +562,7 @@ public class MapsTest extends TestCase { assertEquals(ImmutableMap.of("one", 3, "two", 3, "three", 5), map); assertEquals(Integer.valueOf(5), map.get("three")); assertNull(map.get("five")); - ASSERT.that(map.entrySet()).has().exactly( + assertThat(map.entrySet()).has().exactly( mapEntry("one", 3), mapEntry("two", 3), mapEntry("three", 5)).inOrder(); @@ -585,13 +585,13 @@ public class MapsTest extends TestCase { Map<String, Integer> map = Maps.asMap(strings, LENGTH_FUNCTION); assertEquals(ImmutableMap.of("one", 3, "two", 3, "three", 5), map); assertEquals(Integer.valueOf(3), map.remove("two")); - ASSERT.that(strings).has().exactly("one", "three").inOrder(); + assertThat(strings).has().exactly("one", "three").inOrder(); } public void testAsMapEmpty() { Set<String> strings = ImmutableSet.of(); Map<String, Integer> map = Maps.asMap(strings, LENGTH_FUNCTION); - ASSERT.that(map.entrySet()).isEmpty(); + assertThat(map.entrySet()).isEmpty(); assertTrue(map.isEmpty()); assertNull(map.get("five")); } @@ -618,14 +618,14 @@ public class MapsTest extends TestCase { assertEquals(ImmutableMap.of("one", 3, "two", 3, "three", 5), map); assertEquals(Integer.valueOf(5), map.get("three")); assertNull(map.get("five")); - ASSERT.that(map.entrySet()).has().exactly( + assertThat(map.entrySet()).has().exactly( mapEntry("one", 3), mapEntry("three", 5), mapEntry("two", 3)).inOrder(); - ASSERT.that(map.tailMap("onea").entrySet()).has().exactly( + assertThat(map.tailMap("onea").entrySet()).has().exactly( mapEntry("three", 5), mapEntry("two", 3)).inOrder(); - ASSERT.that(map.subMap("one", "two").entrySet()).has().exactly( + assertThat(map.subMap("one", "two").entrySet()).has().exactly( mapEntry("one", 3), mapEntry("three", 5)).inOrder(); } @@ -651,7 +651,7 @@ public class MapsTest extends TestCase { assertEquals( ImmutableSortedMap.of("five", 4, "four", 4, "three", 5), headMap); - ASSERT.that(map.entrySet()).has().exactly( + assertThat(map.entrySet()).has().exactly( mapEntry("five", 4), mapEntry("four", 4), mapEntry("three", 5), @@ -664,7 +664,7 @@ public class MapsTest extends TestCase { SortedMap<String, Integer> map = Maps.asMap(strings, LENGTH_FUNCTION); assertEquals(ImmutableMap.of("one", 3, "two", 3, "three", 5), map); assertEquals(Integer.valueOf(3), map.remove("two")); - ASSERT.that(strings).has().exactly("one", "three").inOrder(); + assertThat(strings).has().exactly("one", "three").inOrder(); } public void testAsMapSortedSubViewKeySetsDoNotSupportAdd() { @@ -695,7 +695,7 @@ public class MapsTest extends TestCase { public void testAsMapSortedEmpty() { SortedSet<String> strings = new NonNavigableSortedSet(); SortedMap<String, Integer> map = Maps.asMap(strings, LENGTH_FUNCTION); - ASSERT.that(map.entrySet()).isEmpty(); + assertThat(map.entrySet()).isEmpty(); assertTrue(map.isEmpty()); assertNull(map.get("five")); } @@ -704,7 +704,7 @@ public class MapsTest extends TestCase { Iterable<String> strings = ImmutableList.of("one", "two", "three"); ImmutableMap<String, Integer> map = Maps.toMap(strings, LENGTH_FUNCTION); assertEquals(ImmutableMap.of("one", 3, "two", 3, "three", 5), map); - ASSERT.that(map.entrySet()).has().exactly( + assertThat(map.entrySet()).has().exactly( mapEntry("one", 3), mapEntry("two", 3), mapEntry("three", 5)).inOrder(); @@ -714,7 +714,7 @@ public class MapsTest extends TestCase { Iterator<String> strings = ImmutableList.of("one", "two", "three").iterator(); ImmutableMap<String, Integer> map = Maps.toMap(strings, LENGTH_FUNCTION); assertEquals(ImmutableMap.of("one", 3, "two", 3, "three", 5), map); - ASSERT.that(map.entrySet()).has().exactly( + assertThat(map.entrySet()).has().exactly( mapEntry("one", 3), mapEntry("two", 3), mapEntry("three", 5)).inOrder(); @@ -724,7 +724,7 @@ public class MapsTest extends TestCase { Iterable<String> strings = ImmutableList.of("one", "two", "three", "two", "one"); ImmutableMap<String, Integer> map = Maps.toMap(strings, LENGTH_FUNCTION); assertEquals(ImmutableMap.of("one", 3, "two", 3, "three", 5), map); - ASSERT.that(map.entrySet()).has().exactly( + assertThat(map.entrySet()).has().exactly( mapEntry("one", 3), mapEntry("two", 3), mapEntry("three", 5)).inOrder(); @@ -810,37 +810,6 @@ public class MapsTest extends TestCase { } } - /** - * Constructs a "nefarious" map entry with the specified key and value, - * meaning an entry that is suitable for testing that map entries cannot be - * modified via a nefarious implementation of equals. This is used for testing - * unmodifiable collections of map entries; for example, it should not be - * possible to access the raw (modifiable) map entry via a nefarious equals - * method. - */ - public static <K, V> Map.Entry<K, V> nefariousEntry( - final K key, final V value) { - return new AbstractMapEntry<K, V>() { - @Override public K getKey() { - return key; - } - @Override public V getValue() { - return value; - } - @Override public V setValue(V value) { - throw new UnsupportedOperationException(); - } - @SuppressWarnings("unchecked") - @Override public boolean equals(Object o) { - if (o instanceof Map.Entry) { - Map.Entry<K, V> e = (Map.Entry<K, V>) o; - e.setValue(value); // muhahaha! - } - return super.equals(o); - } - }; - } - public void testAsConverter_nominal() throws Exception { ImmutableBiMap<String, Integer> biMap = ImmutableBiMap.of( "one", 1, diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MultimapBuilderTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MultimapBuilderTest.java index 5536a728b..727101e74 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MultimapBuilderTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MultimapBuilderTest.java @@ -17,12 +17,9 @@ package com.google.common.collect; import com.google.common.annotations.GwtCompatible; -import com.google.common.collect.MultimapBuilder.MultimapBuilderWithKeys; -import com.google.common.testing.SerializableTester; import junit.framework.TestCase; -import java.math.RoundingMode; import java.util.SortedMap; import java.util.SortedSet; @@ -49,21 +46,5 @@ public class MultimapBuilderTest extends TestCase { assertTrue(multimap.keySet() instanceof SortedSet); assertTrue(multimap.asMap() instanceof SortedMap); } - - public void testSerialization() { - for (MultimapBuilderWithKeys<?> builderWithKeys : ImmutableList.of( - MultimapBuilder.hashKeys(), MultimapBuilder.linkedHashKeys(), MultimapBuilder.treeKeys(), - MultimapBuilder.enumKeys(RoundingMode.class))) { - for (MultimapBuilder<?, ?> builder : ImmutableList.of( - builderWithKeys.arrayListValues(), - builderWithKeys.linkedListValues(), - builderWithKeys.hashSetValues(), - builderWithKeys.linkedHashSetValues(), - builderWithKeys.treeSetValues(), - builderWithKeys.enumSetValues(RoundingMode.class))) { - SerializableTester.reserializeAndAssert(builder.build()); - } - } - } } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MultimapsTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MultimapsTest.java index e6da7ce71..43b98312e 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MultimapsTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MultimapsTest.java @@ -20,8 +20,8 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.collect.Sets.newHashSet; import static com.google.common.collect.testing.Helpers.nefariousMapEntry; import static com.google.common.collect.testing.IteratorFeature.MODIFIABLE; +import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Function; @@ -205,7 +205,7 @@ public class MultimapsTest extends TestCase { assertEquals(multimap.hashCode(), unmodifiable.hashCode()); assertEquals(multimap, unmodifiable); - ASSERT.that(unmodifiable.asMap().get("bar")).has().exactly(5, -1); + assertThat(unmodifiable.asMap().get("bar")).has().exactly(5, -1); assertNull(unmodifiable.asMap().get("missing")); assertFalse(unmodifiable.entries() instanceof Serializable); @@ -362,11 +362,11 @@ public class MultimapsTest extends TestCase { assertFalse(map.containsKey("bar")); assertEquals(map.keySet(), multimapView.keySet()); assertEquals(map.keySet(), multimapView.keys().elementSet()); - ASSERT.that(multimapView.keys()).has().item("foo"); - ASSERT.that(multimapView.values()).has().item(1); - ASSERT.that(multimapView.entries()).has().item( + assertThat(multimapView.keys()).has().item("foo"); + assertThat(multimapView.values()).has().item(1); + assertThat(multimapView.entries()).has().item( Maps.immutableEntry("foo", 1)); - ASSERT.that(multimapView.asMap().entrySet()).has().item( + assertThat(multimapView.asMap().entrySet()).has().item( Maps.immutableEntry( "foo", (Collection<Integer>) Collections.singleton(1))); multimapView.clear(); @@ -514,7 +514,7 @@ public class MultimapsTest extends TestCase { } catch (IllegalArgumentException expected) { // expected } - ASSERT.that(multimap.entries()).has().exactly( + assertThat(multimap.entries()).has().exactly( Maps.immutableEntry(Color.RED, 1), Maps.immutableEntry(Color.BLUE, 2)); } @@ -732,7 +732,7 @@ public class MultimapsTest extends TestCase { SetMultimap<String, Integer> filtered = Multimaps.filterKeys( multimap, Predicates.in(ImmutableSet.of("foo", "bar"))); Set<Integer> bazSet = filtered.get("baz"); - ASSERT.that(bazSet).isEmpty(); + assertThat(bazSet).isEmpty(); try { bazSet.add(5); fail("Expected IllegalArgumentException"); @@ -755,7 +755,7 @@ public class MultimapsTest extends TestCase { ListMultimap<String, Integer> filtered = Multimaps.filterKeys( multimap, Predicates.in(ImmutableSet.of("foo", "bar"))); List<Integer> bazList = filtered.get("baz"); - ASSERT.that(bazList).isEmpty(); + assertThat(bazList).isEmpty(); try { bazList.add(5); fail("Expected IllegalArgumentException"); diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MultisetsTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MultisetsTest.java index 8fa484274..539462666 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MultisetsTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/MultisetsTest.java @@ -16,7 +16,7 @@ package com.google.common.collect; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.DerivedComparable; @@ -25,6 +25,7 @@ import junit.framework.TestCase; import java.util.Arrays; import java.util.Collections; +import java.util.List; /** * Tests for {@link Multisets}. @@ -43,7 +44,7 @@ public class MultisetsTest extends TestCase { assertTrue(set.isEmpty()); set.add(new DerivedComparable("foo"), 2); set.add(new DerivedComparable("bar"), 3); - ASSERT.that(set).has().exactly( + assertThat(set).has().exactly( new DerivedComparable("bar"), new DerivedComparable("bar"), new DerivedComparable("bar"), new DerivedComparable("foo"), new DerivedComparable("foo")).inOrder(); } @@ -53,7 +54,7 @@ public class MultisetsTest extends TestCase { assertTrue(set.isEmpty()); set.add(new LegacyComparable("foo"), 2); set.add(new LegacyComparable("bar"), 3); - ASSERT.that(set).has().exactly(new LegacyComparable("bar"), + assertThat(set).has().exactly(new LegacyComparable("bar"), new LegacyComparable("bar"), new LegacyComparable("bar"), new LegacyComparable("foo"), new LegacyComparable("foo")).inOrder(); } @@ -63,7 +64,7 @@ public class MultisetsTest extends TestCase { = TreeMultiset.create(Collections.reverseOrder()); multiset.add("bar", 3); multiset.add("foo", 2); - ASSERT.that(multiset).has().exactly("foo", "foo", "bar", "bar", "bar").inOrder(); + assertThat(multiset).has().exactly("foo", "foo", "bar", "bar", "bar").inOrder(); } public void testRetainOccurrencesEmpty() { @@ -71,10 +72,17 @@ public class MultisetsTest extends TestCase { Multiset<String> toRetain = HashMultiset.create(Arrays.asList("a", "b", "a")); assertFalse(Multisets.retainOccurrences(multiset, toRetain)); - ASSERT.that(multiset).isEmpty(); + assertThat(multiset).isEmpty(); } - public void testRemoveOccurrencesEmpty() { + public void testRemoveOccurrencesIterableEmpty() { + Multiset<String> multiset = HashMultiset.create(); + Iterable<String> toRemove = Arrays.asList("a", "b", "a"); + assertFalse(Multisets.removeOccurrences(multiset, toRemove)); + assertTrue(multiset.isEmpty()); + } + + public void testRemoveOccurrencesMultisetEmpty() { Multiset<String> multiset = HashMultiset.create(); Multiset<String> toRemove = HashMultiset.create(Arrays.asList("a", "b", "a")); @@ -86,7 +94,7 @@ public class MultisetsTest extends TestCase { Multiset<String> ms1 = HashMultiset.create(Arrays.asList("a", "b", "a")); Multiset<String> ms2 = HashMultiset.create( Arrays.asList("a", "b", "b", "c")); - ASSERT.that(Multisets.union(ms1, ms2)).has().exactly("a", "a", "b", "b", "c"); + assertThat(Multisets.union(ms1, ms2)).has().exactly("a", "a", "b", "b", "c"); } public void testUnionEqualMultisets() { @@ -110,50 +118,50 @@ public class MultisetsTest extends TestCase { public void testIntersectEmptyNonempty() { Multiset<String> ms1 = HashMultiset.create(); Multiset<String> ms2 = HashMultiset.create(Arrays.asList("a", "b", "a")); - ASSERT.that(Multisets.intersection(ms1, ms2)).isEmpty(); + assertThat(Multisets.intersection(ms1, ms2)).isEmpty(); } public void testIntersectNonemptyEmpty() { Multiset<String> ms1 = HashMultiset.create(Arrays.asList("a", "b", "a")); Multiset<String> ms2 = HashMultiset.create(); - ASSERT.that(Multisets.intersection(ms1, ms2)).isEmpty(); + assertThat(Multisets.intersection(ms1, ms2)).isEmpty(); } public void testSum() { Multiset<String> ms1 = HashMultiset.create(Arrays.asList("a", "b", "a")); Multiset<String> ms2 = HashMultiset.create(Arrays.asList("b", "c")); - ASSERT.that(Multisets.sum(ms1, ms2)).has().exactly("a", "a", "b", "b", "c"); + assertThat(Multisets.sum(ms1, ms2)).has().exactly("a", "a", "b", "b", "c"); } public void testSumEmptyNonempty() { Multiset<String> ms1 = HashMultiset.create(); Multiset<String> ms2 = HashMultiset.create(Arrays.asList("a", "b", "a")); - ASSERT.that(Multisets.sum(ms1, ms2)).has().exactly("a", "b", "a"); + assertThat(Multisets.sum(ms1, ms2)).has().exactly("a", "b", "a"); } public void testSumNonemptyEmpty() { Multiset<String> ms1 = HashMultiset.create(Arrays.asList("a", "b", "a")); Multiset<String> ms2 = HashMultiset.create(); - ASSERT.that(Multisets.sum(ms1, ms2)).has().exactly("a", "b", "a"); + assertThat(Multisets.sum(ms1, ms2)).has().exactly("a", "b", "a"); } public void testDifferenceWithNoRemovedElements() { Multiset<String> ms1 = HashMultiset.create(Arrays.asList("a", "b", "a")); Multiset<String> ms2 = HashMultiset.create(Arrays.asList("a")); - ASSERT.that(Multisets.difference(ms1, ms2)).has().exactly("a", "b"); + assertThat(Multisets.difference(ms1, ms2)).has().exactly("a", "b"); } public void testDifferenceWithRemovedElement() { Multiset<String> ms1 = HashMultiset.create(Arrays.asList("a", "b", "a")); Multiset<String> ms2 = HashMultiset.create(Arrays.asList("b")); - ASSERT.that(Multisets.difference(ms1, ms2)).has().exactly("a", "a"); + assertThat(Multisets.difference(ms1, ms2)).has().exactly("a", "a"); } public void testDifferenceWithMoreElementsInSecondMultiset() { Multiset<String> ms1 = HashMultiset.create(Arrays.asList("a", "b", "a")); Multiset<String> ms2 = HashMultiset.create(Arrays.asList("a", "b", "b", "b")); Multiset<String> diff = Multisets.difference(ms1, ms2); - ASSERT.that(diff).has().item("a"); + assertThat(diff).has().item("a"); assertEquals(0, diff.count("b")); assertEquals(1, diff.count("a")); assertFalse(diff.contains("b")); @@ -203,24 +211,40 @@ public class MultisetsTest extends TestCase { Multiset<String> toRetain = HashMultiset.create(Arrays.asList("a", "b", "b")); assertTrue(Multisets.retainOccurrences(multiset, toRetain)); - ASSERT.that(multiset).has().exactly("a", "b").inOrder(); + assertThat(multiset).has().exactly("a", "b").inOrder(); } - public void testRemoveEmptyOccurrences() { + public void testRemoveEmptyOccurrencesMultiset() { Multiset<String> multiset = TreeMultiset.create(Arrays.asList("a", "b", "a")); Multiset<String> toRemove = HashMultiset.create(); assertFalse(Multisets.removeOccurrences(multiset, toRemove)); - ASSERT.that(multiset).has().exactly("a", "a", "b").inOrder(); + assertThat(multiset).has().exactly("a", "a", "b").inOrder(); } - public void testRemoveOccurrences() { + public void testRemoveOccurrencesMultiset() { Multiset<String> multiset = TreeMultiset.create(Arrays.asList("a", "b", "a", "c")); Multiset<String> toRemove = HashMultiset.create(Arrays.asList("a", "b", "b")); assertTrue(Multisets.removeOccurrences(multiset, toRemove)); - ASSERT.that(multiset).has().exactly("a", "c").inOrder(); + assertThat(multiset).has().exactly("a", "c").inOrder(); + } + + public void testRemoveEmptyOccurrencesIterable() { + Multiset<String> multiset = + TreeMultiset.create(Arrays.asList("a", "b", "a")); + Iterable<String> toRemove = ImmutableList.of(); + assertFalse(Multisets.removeOccurrences(multiset, toRemove)); + assertThat(multiset).has().exactly("a", "a", "b").inOrder(); + } + + public void testRemoveOccurrencesMultisetIterable() { + Multiset<String> multiset = + TreeMultiset.create(Arrays.asList("a", "b", "a", "c")); + List<String> toRemove = Arrays.asList("a", "b", "b"); + assertTrue(Multisets.removeOccurrences(multiset, toRemove)); + assertThat(multiset).has().exactly("a", "c").inOrder(); } @SuppressWarnings("deprecation") @@ -240,11 +264,11 @@ public class MultisetsTest extends TestCase { ImmutableMultiset<String> sortedMultiset = Multisets.copyHighestCountFirst(multiset); - ASSERT.that(sortedMultiset.entrySet()).has().exactly( + assertThat(sortedMultiset.entrySet()).has().exactly( Multisets.immutableEntry("a", 3), Multisets.immutableEntry("c", 2), Multisets.immutableEntry("b", 1)).inOrder(); - ASSERT.that(sortedMultiset).has().exactly( + assertThat(sortedMultiset).has().exactly( "a", "a", "a", @@ -252,7 +276,7 @@ public class MultisetsTest extends TestCase { "c", "b").inOrder(); - ASSERT.that(Multisets.copyHighestCountFirst(ImmutableMultiset.of())).isEmpty(); + assertThat(Multisets.copyHighestCountFirst(ImmutableMultiset.of())).isEmpty(); } } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ObjectArraysTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ObjectArraysTest.java index f43d446ec..b9342daad 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ObjectArraysTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/ObjectArraysTest.java @@ -16,7 +16,7 @@ package com.google.common.collect; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; @@ -99,32 +99,32 @@ public class ObjectArraysTest extends TestCase { public void testPrependZeroElements() { String[] result = ObjectArrays.concat("foo", new String[] {}); - ASSERT.that(result).has().item("foo"); + assertThat(result).asList().has().item("foo"); } public void testPrependOneElement() { String[] result = ObjectArrays.concat("foo", new String[] { "bar" }); - ASSERT.that(result).has().exactly("foo", "bar").inOrder(); + assertThat(result).asList().has().exactly("foo", "bar").inOrder(); } public void testPrependTwoElements() { String[] result = ObjectArrays.concat("foo", new String[] { "bar", "baz" }); - ASSERT.that(result).has().exactly("foo", "bar", "baz").inOrder(); + assertThat(result).asList().has().exactly("foo", "bar", "baz").inOrder(); } public void testAppendZeroElements() { String[] result = ObjectArrays.concat(new String[] {}, "foo"); - ASSERT.that(result).has().item("foo"); + assertThat(result).asList().has().item("foo"); } public void testAppendOneElement() { String[] result = ObjectArrays.concat(new String[] { "foo" }, "bar"); - ASSERT.that(result).has().exactly("foo", "bar").inOrder(); + assertThat(result).asList().has().exactly("foo", "bar").inOrder(); } public void testAppendTwoElements() { String[] result = ObjectArrays.concat(new String[] { "foo", "bar" }, "baz"); - ASSERT.that(result).has().exactly("foo", "bar", "baz").inOrder(); + assertThat(result).asList().has().exactly("foo", "bar", "baz").inOrder(); } public void testEmptyArrayToEmpty() { diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/OrderingTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/OrderingTest.java index e7978811b..579842cbd 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/OrderingTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/OrderingTest.java @@ -20,8 +20,8 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.collect.Lists.newArrayList; import static com.google.common.testing.SerializableTester.reserialize; import static com.google.common.testing.SerializableTester.reserializeAndAssert; +import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Function; @@ -155,7 +155,7 @@ public class OrderingTest extends TestCase { = Ordering.explicit(2, 8, 6, 1, 7, 5, 3, 4, 0, 9); List<Integer> list = Arrays.asList(0, 3, 5, 6, 7, 8, 9); Collections.sort(list, c); - ASSERT.that(list).has().exactly(8, 6, 7, 5, 3, 0, 9).inOrder(); + assertThat(list).has().exactly(8, 6, 7, 5, 3, 0, 9).inOrder(); reserializeAndAssert(c); } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/SetsTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/SetsTest.java index 7173bc65a..6242ee291 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/SetsTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/SetsTest.java @@ -22,9 +22,9 @@ import static com.google.common.collect.Sets.newHashSet; import static com.google.common.collect.Sets.newLinkedHashSet; import static com.google.common.collect.Sets.powerSet; import static com.google.common.collect.testing.IteratorFeature.UNMODIFIABLE; +import static com.google.common.truth.Truth.assertThat; import static java.util.Collections.emptySet; import static java.util.Collections.singleton; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.IteratorTester; @@ -91,7 +91,7 @@ public class SetsTest extends TestCase { public void testImmutableEnumSet() { Set<SomeEnum> units = Sets.immutableEnumSet(SomeEnum.D, SomeEnum.B); - ASSERT.that(units).has().exactly(SomeEnum.B, SomeEnum.D).inOrder(); + assertThat(units).has().exactly(SomeEnum.B, SomeEnum.D).inOrder(); try { units.remove(SomeEnum.B); fail("ImmutableEnumSet should throw an exception on remove()"); @@ -105,15 +105,15 @@ public class SetsTest extends TestCase { public void testImmutableEnumSet_fromIterable() { ImmutableSet<SomeEnum> none = Sets.immutableEnumSet(MinimalIterable.<SomeEnum>of()); - ASSERT.that(none).isEmpty(); + assertThat(none).isEmpty(); ImmutableSet<SomeEnum> one = Sets.immutableEnumSet(MinimalIterable.of(SomeEnum.B)); - ASSERT.that(one).has().item(SomeEnum.B); + assertThat(one).has().item(SomeEnum.B); ImmutableSet<SomeEnum> two = Sets.immutableEnumSet(MinimalIterable.of(SomeEnum.D, SomeEnum.B)); - ASSERT.that(two).has().exactly(SomeEnum.B, SomeEnum.D).inOrder(); + assertThat(two).has().exactly(SomeEnum.B, SomeEnum.D).inOrder(); } private static byte[] prepended(byte b, byte[] array) { @@ -230,7 +230,7 @@ public class SetsTest extends TestCase { assertTrue(set.isEmpty()); set.add(new Derived("foo")); set.add(new Derived("bar")); - ASSERT.that(set).has().exactly(new Derived("bar"), new Derived("foo")).inOrder(); + assertThat(set).has().exactly(new Derived("bar"), new Derived("foo")).inOrder(); } public void testNewTreeSetEmptyNonGeneric() { @@ -238,7 +238,7 @@ public class SetsTest extends TestCase { assertTrue(set.isEmpty()); set.add(new LegacyComparable("foo")); set.add(new LegacyComparable("bar")); - ASSERT.that(set).has() + assertThat(set).has() .exactly(new LegacyComparable("bar"), new LegacyComparable("foo")).inOrder(); } @@ -256,7 +256,7 @@ public class SetsTest extends TestCase { Iterable<Derived> iterable = Arrays.asList(new Derived("foo"), new Derived("bar")); TreeSet<Derived> set = Sets.newTreeSet(iterable); - ASSERT.that(set).has().exactly( + assertThat(set).has().exactly( new Derived("bar"), new Derived("foo")).inOrder(); } @@ -264,7 +264,7 @@ public class SetsTest extends TestCase { Iterable<LegacyComparable> iterable = Arrays.asList(new LegacyComparable("foo"), new LegacyComparable("bar")); TreeSet<LegacyComparable> set = Sets.newTreeSet(iterable); - ASSERT.that(set).has().exactly( + assertThat(set).has().exactly( new LegacyComparable("bar"), new LegacyComparable("foo")).inOrder(); } @@ -357,7 +357,7 @@ public class SetsTest extends TestCase { */ @SuppressWarnings("unchecked") // varargs! public void testCartesianProduct_zeroary() { - ASSERT.that(Sets.cartesianProduct()).has().exactly(list()); + assertThat(Sets.cartesianProduct()).has().exactly(list()); } /** @@ -366,7 +366,7 @@ public class SetsTest extends TestCase { */ @SuppressWarnings("unchecked") // varargs! public void testCartesianProduct_unary() { - ASSERT.that(Sets.cartesianProduct(set(1, 2))).has().exactly(list(1), list(2)); + assertThat(Sets.cartesianProduct(set(1, 2))).has().exactly(list(1), list(2)); } @SuppressWarnings("unchecked") // varargs! @@ -395,24 +395,24 @@ public class SetsTest extends TestCase { @SuppressWarnings("unchecked") // varargs! public void testCartesianProduct_binary1x1() { - ASSERT.that(Sets.cartesianProduct(set(1), set(2))).has().item(list(1, 2)); + assertThat(Sets.cartesianProduct(set(1), set(2))).has().item(list(1, 2)); } @SuppressWarnings("unchecked") // varargs! public void testCartesianProduct_binary1x2() { - ASSERT.that(Sets.cartesianProduct(set(1), set(2, 3))) + assertThat(Sets.cartesianProduct(set(1), set(2, 3))) .has().exactly(list(1, 2), list(1, 3)).inOrder(); } @SuppressWarnings("unchecked") // varargs! public void testCartesianProduct_binary2x2() { - ASSERT.that(Sets.cartesianProduct(set(1, 2), set(3, 4))) + assertThat(Sets.cartesianProduct(set(1, 2), set(3, 4))) .has().exactly(list(1, 3), list(1, 4), list(2, 3), list(2, 4)).inOrder(); } @SuppressWarnings("unchecked") // varargs! public void testCartesianProduct_2x2x2() { - ASSERT.that(Sets.cartesianProduct(set(0, 1), set(0, 1), set(0, 1))).has().exactly( + assertThat(Sets.cartesianProduct(set(0, 1), set(0, 1), set(0, 1))).has().exactly( list(0, 0, 0), list(0, 0, 1), list(0, 1, 0), list(0, 1, 1), list(1, 0, 0), list(1, 0, 1), list(1, 1, 0), list(1, 1, 1)).inOrder(); } @@ -437,7 +437,7 @@ public class SetsTest extends TestCase { List<Object> exp3 = list((Object) 2, "3"); List<Object> exp4 = list((Object) 2, "4"); - ASSERT.that(Sets.<Object>cartesianProduct(x, y)) + assertThat(Sets.<Object>cartesianProduct(x, y)) .has().exactly(exp1, exp2, exp3, exp4).inOrder(); } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableTableTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableTableTest.java index 36c107f2e..c21fdc093 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableTableTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableTableTest.java @@ -16,7 +16,7 @@ package com.google.common.collect; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Objects; @@ -117,7 +117,7 @@ public class SingletonImmutableTableTest extends AbstractImmutableTableTest { } public void testValues() { - ASSERT.that(testTable.values()).has().item("blah"); + assertThat(testTable.values()).has().item("blah"); } @Override Iterable<ImmutableTable<Character, Integer, String>> getTestInstances() { diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeBasedTableTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeBasedTableTest.java index 126152e1f..7977f8dd8 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeBasedTableTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeBasedTableTest.java @@ -16,7 +16,7 @@ package com.google.common.collect; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.SortedMapInterfaceTest; @@ -117,8 +117,8 @@ public class TreeBasedTableTest extends AbstractTableTest { table.put("foo", 12, 'b'); table.put("bar", 5, 'c'); table.put("cat", 8, 'd'); - ASSERT.that(table.rowKeySet()).has().exactly("foo", "cat", "bar").inOrder(); - ASSERT.that(table.row("foo").keySet()).has().exactly(12, 3).inOrder(); + assertThat(table.rowKeySet()).has().exactly("foo", "cat", "bar").inOrder(); + assertThat(table.row("foo").keySet()).has().exactly(12, 3).inOrder(); } public void testCreateCopy() { @@ -129,8 +129,8 @@ public class TreeBasedTableTest extends AbstractTableTest { original.put("bar", 5, 'c'); original.put("cat", 8, 'd'); table = TreeBasedTable.create(original); - ASSERT.that(table.rowKeySet()).has().exactly("foo", "cat", "bar").inOrder(); - ASSERT.that(table.row("foo").keySet()).has().exactly(12, 3).inOrder(); + assertThat(table.rowKeySet()).has().exactly("foo", "cat", "bar").inOrder(); + assertThat(table.row("foo").keySet()).has().exactly(12, 3).inOrder(); assertEquals(original, table); } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeMultimapExplicitTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeMultimapExplicitTest.java index 3d0fcf2d5..e0b1ec411 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeMultimapExplicitTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeMultimapExplicitTest.java @@ -16,7 +16,7 @@ package com.google.common.collect; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; @@ -97,13 +97,13 @@ public class TreeMultimapExplicitTest extends TestCase { tree.put("google", 6); tree.put("tree", 0); tree.put("tree", 3); - ASSERT.that(tree.keySet()).has().exactly("tree", "google").inOrder(); - ASSERT.that(tree.get("google")).has().exactly(6, 2).inOrder(); + assertThat(tree.keySet()).has().exactly("tree", "google").inOrder(); + assertThat(tree.get("google")).has().exactly(6, 2).inOrder(); TreeMultimap<String, Integer> copy = TreeMultimap.create(tree); assertEquals(tree, copy); - ASSERT.that(copy.keySet()).has().exactly("google", "tree").inOrder(); - ASSERT.that(copy.get("google")).has().exactly(2, 6).inOrder(); + assertThat(copy.keySet()).has().exactly("google", "tree").inOrder(); + assertThat(copy.get("google")).has().exactly(2, 6).inOrder(); assertEquals(Ordering.natural(), copy.keyComparator()); assertEquals(Ordering.natural(), copy.valueComparator()); assertEquals(Ordering.natural(), copy.get("google").comparator()); @@ -128,14 +128,14 @@ public class TreeMultimapExplicitTest extends TestCase { public void testOrderedGet() { TreeMultimap<String, Integer> multimap = createPopulate(); - ASSERT.that(multimap.get(null)).has().exactly(7, 3, 1).inOrder(); - ASSERT.that(multimap.get("google")).has().exactly(6, 2).inOrder(); - ASSERT.that(multimap.get("tree")).has().exactly(null, 0).inOrder(); + assertThat(multimap.get(null)).has().exactly(7, 3, 1).inOrder(); + assertThat(multimap.get("google")).has().exactly(6, 2).inOrder(); + assertThat(multimap.get("tree")).has().exactly(null, 0).inOrder(); } public void testOrderedKeySet() { TreeMultimap<String, Integer> multimap = createPopulate(); - ASSERT.that(multimap.keySet()).has().exactly(null, "tree", "google").inOrder(); + assertThat(multimap.keySet()).has().exactly(null, "tree", "google").inOrder(); } public void testOrderedAsMapEntries() { @@ -144,18 +144,18 @@ public class TreeMultimapExplicitTest extends TestCase { multimap.asMap().entrySet().iterator(); Map.Entry<String, Collection<Integer>> entry = iterator.next(); assertEquals(null, entry.getKey()); - ASSERT.that(entry.getValue()).has().exactly(7, 3, 1); + assertThat(entry.getValue()).has().exactly(7, 3, 1); entry = iterator.next(); assertEquals("tree", entry.getKey()); - ASSERT.that(entry.getValue()).has().exactly(null, 0); + assertThat(entry.getValue()).has().exactly(null, 0); entry = iterator.next(); assertEquals("google", entry.getKey()); - ASSERT.that(entry.getValue()).has().exactly(6, 2); + assertThat(entry.getValue()).has().exactly(6, 2); } public void testOrderedEntries() { TreeMultimap<String, Integer> multimap = createPopulate(); - ASSERT.that(multimap.entries()).has().exactly( + assertThat(multimap.entries()).has().exactly( Maps.immutableEntry((String) null, 7), Maps.immutableEntry((String) null, 3), Maps.immutableEntry((String) null, 1), @@ -167,7 +167,7 @@ public class TreeMultimapExplicitTest extends TestCase { public void testOrderedValues() { TreeMultimap<String, Integer> multimap = createPopulate(); - ASSERT.that(multimap.values()).has().exactly(7, 3, 1, null, 0, 6, 2).inOrder(); + assertThat(multimap.values()).has().exactly(7, 3, 1, null, 0, 6, 2).inOrder(); } public void testComparator() { diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeMultimapNaturalTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeMultimapNaturalTest.java index f29ee18bd..388295882 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeMultimapNaturalTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeMultimapNaturalTest.java @@ -16,7 +16,7 @@ package com.google.common.collect; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; @@ -68,14 +68,14 @@ public class TreeMultimapNaturalTest extends TestCase { public void testOrderedGet() { TreeMultimap<String, Integer> multimap = createPopulate(); - ASSERT.that(multimap.get("foo")).has().exactly(1, 3, 7).inOrder(); - ASSERT.that(multimap.get("google")).has().exactly(2, 6).inOrder(); - ASSERT.that(multimap.get("tree")).has().exactly(0, 4).inOrder(); + assertThat(multimap.get("foo")).has().exactly(1, 3, 7).inOrder(); + assertThat(multimap.get("google")).has().exactly(2, 6).inOrder(); + assertThat(multimap.get("tree")).has().exactly(0, 4).inOrder(); } public void testOrderedKeySet() { TreeMultimap<String, Integer> multimap = createPopulate(); - ASSERT.that(multimap.keySet()).has().exactly("foo", "google", "tree").inOrder(); + assertThat(multimap.keySet()).has().exactly("foo", "google", "tree").inOrder(); } public void testOrderedAsMapEntries() { @@ -84,18 +84,18 @@ public class TreeMultimapNaturalTest extends TestCase { multimap.asMap().entrySet().iterator(); Map.Entry<String, Collection<Integer>> entry = iterator.next(); assertEquals("foo", entry.getKey()); - ASSERT.that(entry.getValue()).has().exactly(1, 3, 7); + assertThat(entry.getValue()).has().exactly(1, 3, 7); entry = iterator.next(); assertEquals("google", entry.getKey()); - ASSERT.that(entry.getValue()).has().exactly(2, 6); + assertThat(entry.getValue()).has().exactly(2, 6); entry = iterator.next(); assertEquals("tree", entry.getKey()); - ASSERT.that(entry.getValue()).has().exactly(0, 4); + assertThat(entry.getValue()).has().exactly(0, 4); } public void testOrderedEntries() { TreeMultimap<String, Integer> multimap = createPopulate(); - ASSERT.that(multimap.entries()).has().exactly( + assertThat(multimap.entries()).has().exactly( Maps.immutableEntry("foo", 1), Maps.immutableEntry("foo", 3), Maps.immutableEntry("foo", 7), @@ -107,7 +107,7 @@ public class TreeMultimapNaturalTest extends TestCase { public void testOrderedValues() { TreeMultimap<String, Integer> multimap = createPopulate(); - ASSERT.that(multimap.values()).has().exactly( + assertThat(multimap.values()).has().exactly( 1, 3, 7, 2, 6, 0, 4).inOrder(); } diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeMultisetTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeMultisetTest.java index 7a0be3b03..65f1a957f 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeMultisetTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeMultisetTest.java @@ -17,7 +17,7 @@ package com.google.common.collect; import static com.google.common.collect.BoundType.CLOSED; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; @@ -83,9 +83,9 @@ public class TreeMultisetTest extends TestCase { assertEquals("c", elementSet.last()); assertEquals(Ordering.natural(), elementSet.comparator()); - ASSERT.that(elementSet.headSet("b")).has().exactly("a").inOrder(); - ASSERT.that(elementSet.tailSet("b")).has().exactly("b", "c").inOrder(); - ASSERT.that(elementSet.subSet("a", "c")).has().exactly("a", "b").inOrder(); + assertThat(elementSet.headSet("b")).has().exactly("a").inOrder(); + assertThat(elementSet.tailSet("b")).has().exactly("b", "c").inOrder(); + assertThat(elementSet.subSet("a", "c")).has().exactly("a", "b").inOrder(); } public void testElementSetSubsetRemove() { @@ -98,18 +98,18 @@ public class TreeMultisetTest extends TestCase { ms.add("f", 2); SortedSet<String> elementSet = ms.elementSet(); - ASSERT.that(elementSet).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); + assertThat(elementSet).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); SortedSet<String> subset = elementSet.subSet("b", "f"); - ASSERT.that(subset).has().exactly("b", "c", "d", "e").inOrder(); + assertThat(subset).has().exactly("b", "c", "d", "e").inOrder(); assertTrue(subset.remove("c")); - ASSERT.that(elementSet).has().exactly("a", "b", "d", "e", "f").inOrder(); - ASSERT.that(subset).has().exactly("b", "d", "e").inOrder(); + assertThat(elementSet).has().exactly("a", "b", "d", "e", "f").inOrder(); + assertThat(subset).has().exactly("b", "d", "e").inOrder(); assertEquals(10, ms.size()); assertFalse(subset.remove("a")); - ASSERT.that(elementSet).has().exactly("a", "b", "d", "e", "f").inOrder(); - ASSERT.that(subset).has().exactly("b", "d", "e").inOrder(); + assertThat(elementSet).has().exactly("a", "b", "d", "e", "f").inOrder(); + assertThat(subset).has().exactly("b", "d", "e").inOrder(); assertEquals(10, ms.size()); } @@ -123,13 +123,13 @@ public class TreeMultisetTest extends TestCase { ms.add("f", 2); SortedSet<String> elementSet = ms.elementSet(); - ASSERT.that(elementSet).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); + assertThat(elementSet).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); SortedSet<String> subset = elementSet.subSet("b", "f"); - ASSERT.that(subset).has().exactly("b", "c", "d", "e").inOrder(); + assertThat(subset).has().exactly("b", "c", "d", "e").inOrder(); assertTrue(subset.removeAll(Arrays.asList("a", "c"))); - ASSERT.that(elementSet).has().exactly("a", "b", "d", "e", "f").inOrder(); - ASSERT.that(subset).has().exactly("b", "d", "e").inOrder(); + assertThat(elementSet).has().exactly("a", "b", "d", "e", "f").inOrder(); + assertThat(subset).has().exactly("b", "d", "e").inOrder(); assertEquals(10, ms.size()); } @@ -143,13 +143,13 @@ public class TreeMultisetTest extends TestCase { ms.add("f", 2); SortedSet<String> elementSet = ms.elementSet(); - ASSERT.that(elementSet).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); + assertThat(elementSet).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); SortedSet<String> subset = elementSet.subSet("b", "f"); - ASSERT.that(subset).has().exactly("b", "c", "d", "e").inOrder(); + assertThat(subset).has().exactly("b", "c", "d", "e").inOrder(); assertTrue(subset.retainAll(Arrays.asList("a", "c"))); - ASSERT.that(elementSet).has().exactly("a", "c", "f").inOrder(); - ASSERT.that(subset).has().exactly("c").inOrder(); + assertThat(elementSet).has().exactly("a", "c", "f").inOrder(); + assertThat(subset).has().exactly("c").inOrder(); assertEquals(5, ms.size()); } @@ -163,13 +163,13 @@ public class TreeMultisetTest extends TestCase { ms.add("f", 2); SortedSet<String> elementSet = ms.elementSet(); - ASSERT.that(elementSet).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); + assertThat(elementSet).has().exactly("a", "b", "c", "d", "e", "f").inOrder(); SortedSet<String> subset = elementSet.subSet("b", "f"); - ASSERT.that(subset).has().exactly("b", "c", "d", "e").inOrder(); + assertThat(subset).has().exactly("b", "c", "d", "e").inOrder(); subset.clear(); - ASSERT.that(elementSet).has().exactly("a", "f").inOrder(); - ASSERT.that(subset).isEmpty(); + assertThat(elementSet).has().exactly("a", "f").inOrder(); + assertThat(subset).isEmpty(); assertEquals(3, ms.size()); } @@ -188,7 +188,7 @@ public class TreeMultisetTest extends TestCase { ms.add("b"); ms.add("d"); - ASSERT.that(ms).has().exactly("d", "c", "b", "b", "a").inOrder(); + assertThat(ms).has().exactly("d", "c", "b", "b", "a").inOrder(); SortedSet<String> elementSet = ms.elementSet(); assertEquals("d", elementSet.first()); @@ -206,7 +206,7 @@ public class TreeMultisetTest extends TestCase { ms.add("b"); ms.add(null, 2); - ASSERT.that(ms).has().exactly(null, null, null, "a", "b", "b").inOrder(); + assertThat(ms).has().exactly(null, null, null, "a", "b", "b").inOrder(); assertEquals(3, ms.count(null)); SortedSet<String> elementSet = ms.elementSet(); diff --git a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeTraverserTest.java b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeTraverserTest.java index 7ae9672c2..76f0a0c43 100644 --- a/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeTraverserTest.java +++ b/guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/TreeTraverserTest.java @@ -14,7 +14,7 @@ package com.google.common.collect; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Optional; @@ -126,22 +126,22 @@ public class TreeTraverserTest extends TestCase { } public void testPreOrder() { - ASSERT.that(iterationOrder(ADAPTER.preOrderTraversal(h))).is("hdabcegf"); - ASSERT.that(binaryIterationOrder(BIN_ADAPTER.preOrderTraversal(bd))).is("dbacefg"); + assertThat(iterationOrder(ADAPTER.preOrderTraversal(h))).isEqualTo("hdabcegf"); + assertThat(binaryIterationOrder(BIN_ADAPTER.preOrderTraversal(bd))).isEqualTo("dbacefg"); } public void testPostOrder() { - ASSERT.that(iterationOrder(ADAPTER.postOrderTraversal(h))).is("abcdefgh"); - ASSERT.that(binaryIterationOrder(BIN_ADAPTER.postOrderTraversal(bd))).is("acbgfed"); + assertThat(iterationOrder(ADAPTER.postOrderTraversal(h))).isEqualTo("abcdefgh"); + assertThat(binaryIterationOrder(BIN_ADAPTER.postOrderTraversal(bd))).isEqualTo("acbgfed"); } public void testBreadthOrder() { - ASSERT.that(iterationOrder(ADAPTER.breadthFirstTraversal(h))).is("hdegabcf"); - ASSERT.that(binaryIterationOrder(BIN_ADAPTER.breadthFirstTraversal(bd))).is("dbeacfg"); + assertThat(iterationOrder(ADAPTER.breadthFirstTraversal(h))).isEqualTo("hdegabcf"); + assertThat(binaryIterationOrder(BIN_ADAPTER.breadthFirstTraversal(bd))).isEqualTo("dbeacfg"); } public void testInOrder() { - ASSERT.that(binaryIterationOrder(BIN_ADAPTER.inOrderTraversal(bd))).is("abcdegf"); + assertThat(binaryIterationOrder(BIN_ADAPTER.inOrderTraversal(bd))).isEqualTo("abcdegf"); } } diff --git a/guava-gwt/test-super/com/google/common/collect/testing/google/super/com/google/common/collect/testing/google/MultisetRemoveTester.java b/guava-gwt/test-super/com/google/common/collect/testing/google/super/com/google/common/collect/testing/google/MultisetRemoveTester.java index 26fedfa38..46148b9ee 100644 --- a/guava-gwt/test-super/com/google/common/collect/testing/google/super/com/google/common/collect/testing/google/MultisetRemoveTester.java +++ b/guava-gwt/test-super/com/google/common/collect/testing/google/super/com/google/common/collect/testing/google/MultisetRemoveTester.java @@ -21,7 +21,7 @@ import static com.google.common.collect.testing.features.CollectionFeature.ALLOW import static com.google.common.collect.testing.features.CollectionFeature.SUPPORTS_REMOVE; import static com.google.common.collect.testing.features.CollectionSize.SEVERAL; import static com.google.common.collect.testing.features.CollectionSize.ZERO; -import static org.truth0.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.Helpers; @@ -150,7 +150,7 @@ public class MultisetRemoveTester<E> extends AbstractMultisetTester<E> { public void testRemoveAllIgnoresCount() { initThreeCopies(); assertTrue(getMultiset().removeAll(Collections.singleton(samples.e0))); - ASSERT.that(getMultiset()).isEmpty(); + assertThat(getMultiset()).isEmpty(); } @CollectionSize.Require(SEVERAL) diff --git a/guava-gwt/test-super/com/google/common/collect/testing/super/com/google/common/collect/testing/Platform.java b/guava-gwt/test-super/com/google/common/collect/testing/super/com/google/common/collect/testing/Platform.java index a98e026c7..8dbda2f6c 100644 --- a/guava-gwt/test-super/com/google/common/collect/testing/super/com/google/common/collect/testing/Platform.java +++ b/guava-gwt/test-super/com/google/common/collect/testing/super/com/google/common/collect/testing/Platform.java @@ -74,9 +74,5 @@ final class Platform { return builder.toString(); } - static String classGetSimpleName(Class<?> clazz) { - throw new UnsupportedOperationException("Shouldn't be called in GWT."); - } - private Platform() {} } diff --git a/guava-gwt/test-super/com/google/common/net/super/com/google/common/net/InternetDomainNameTest.java b/guava-gwt/test-super/com/google/common/net/super/com/google/common/net/InternetDomainNameTest.java index 655e409c3..8dda0c50c 100644 --- a/guava-gwt/test-super/com/google/common/net/super/com/google/common/net/InternetDomainNameTest.java +++ b/guava-gwt/test-super/com/google/common/net/super/com/google/common/net/InternetDomainNameTest.java @@ -365,9 +365,9 @@ public final class InternetDomainNameTest extends TestCase { } public void testExclusion() { - InternetDomainName domain = InternetDomainName.from("foo.nic.uk"); + InternetDomainName domain = InternetDomainName.from("foo.teledata.mz"); assertTrue(domain.hasPublicSuffix()); - assertEquals("uk", domain.publicSuffix().toString()); + assertEquals("mz", domain.publicSuffix().toString()); // Behold the weirdness! assertFalse(domain.publicSuffix().isPublicSuffix()); diff --git a/guava-gwt/test-super/com/google/common/primitives/super/com/google/common/primitives/DoublesTest.java b/guava-gwt/test-super/com/google/common/primitives/super/com/google/common/primitives/DoublesTest.java index 7713fd6e3..84717f31e 100644 --- a/guava-gwt/test-super/com/google/common/primitives/super/com/google/common/primitives/DoublesTest.java +++ b/guava-gwt/test-super/com/google/common/primitives/super/com/google/common/primitives/DoublesTest.java @@ -16,8 +16,8 @@ package com.google.common.primitives; +import static com.google.common.truth.Truth.assertThat; import static java.lang.Double.NaN; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Converter; @@ -345,7 +345,7 @@ public class DoublesTest extends TestCase { list.set(0, (double) 2); assertTrue(Arrays.equals(new double[] {(double) 2, (double) 1}, array)); array[1] = (double) 3; - ASSERT.that(list).has().exactly((double) 2, (double) 3).inOrder(); + assertThat(list).has().exactly((double) 2, (double) 3).inOrder(); } public void testAsList_toArray_roundTrip() { diff --git a/guava-gwt/test-super/com/google/common/primitives/super/com/google/common/primitives/FloatsTest.java b/guava-gwt/test-super/com/google/common/primitives/super/com/google/common/primitives/FloatsTest.java index 1f6543eb2..d13671928 100644 --- a/guava-gwt/test-super/com/google/common/primitives/super/com/google/common/primitives/FloatsTest.java +++ b/guava-gwt/test-super/com/google/common/primitives/super/com/google/common/primitives/FloatsTest.java @@ -16,8 +16,8 @@ package com.google.common.primitives; +import static com.google.common.truth.Truth.assertThat; import static java.lang.Float.NaN; -import static org.truth0.Truth.ASSERT; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.Helpers; @@ -335,7 +335,7 @@ public class FloatsTest extends TestCase { list.set(0, (float) 2); assertTrue(Arrays.equals(new float[] {(float) 2, (float) 1}, array)); array[1] = (float) 3; - ASSERT.that(list).has().exactly((float) 2, (float) 3).inOrder(); + assertThat(list).has().exactly((float) 2, (float) 3).inOrder(); } public void testAsList_toArray_roundTrip() { diff --git a/guava-gwt/test-super/com/google/common/primitives/super/com/google/common/primitives/IntsTest.java b/guava-gwt/test-super/com/google/common/primitives/super/com/google/common/primitives/IntsTest.java index 37e4e226c..f1e7ed1c7 100644 --- a/guava-gwt/test-super/com/google/common/primitives/super/com/google/common/primitives/IntsTest.java +++ b/guava-gwt/test-super/com/google/common/primitives/super/com/google/common/primitives/IntsTest.java @@ -390,5 +390,38 @@ public class IntsTest extends TestCase { assertEquals("-255", converter.reverse().convert(-0xFF)); assertEquals("438", converter.reverse().convert(0666)); } -} + public void testTryParse() { + tryParseAndAssertEquals(0, "0"); + tryParseAndAssertEquals(0, "-0"); + tryParseAndAssertEquals(1, "1"); + tryParseAndAssertEquals(-1, "-1"); + tryParseAndAssertEquals(8900, "8900"); + tryParseAndAssertEquals(-8900, "-8900"); + tryParseAndAssertEquals(GREATEST, Integer.toString(GREATEST)); + tryParseAndAssertEquals(LEAST, Integer.toString(LEAST)); + assertNull(Ints.tryParse("")); + assertNull(Ints.tryParse("-")); + assertNull(Ints.tryParse("+1")); + assertNull(Ints.tryParse("9999999999999999")); + assertNull("Max integer + 1", + Ints.tryParse(Long.toString(((long) GREATEST) + 1))); + assertNull("Max integer * 10", + Ints.tryParse(Long.toString(((long) GREATEST) * 10))); + assertNull("Min integer - 1", + Ints.tryParse(Long.toString(((long) LEAST) - 1))); + assertNull("Min integer * 10", + Ints.tryParse(Long.toString(((long) LEAST) * 10))); + assertNull("Max long", Ints.tryParse(Long.toString(Long.MAX_VALUE))); + assertNull("Min long", Ints.tryParse(Long.toString(Long.MIN_VALUE))); + assertNull(Ints.tryParse("\u0662\u06f3")); + } + + /** + * Applies {@link Ints#tryParse(String)} to the given string and asserts that + * the result is as expected. + */ + private static void tryParseAndAssertEquals(Integer expected, String value) { + assertEquals(expected, Ints.tryParse(value)); + } +} diff --git a/guava-gwt/test-super/com/google/common/primitives/super/com/google/common/primitives/LongsTest.java b/guava-gwt/test-super/com/google/common/primitives/super/com/google/common/primitives/LongsTest.java index 833779e6e..c1556ccdd 100644 --- a/guava-gwt/test-super/com/google/common/primitives/super/com/google/common/primitives/LongsTest.java +++ b/guava-gwt/test-super/com/google/common/primitives/super/com/google/common/primitives/LongsTest.java @@ -25,6 +25,7 @@ import com.google.common.collect.testing.Helpers; import junit.framework.TestCase; +import java.math.BigInteger; import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -412,6 +413,30 @@ public class LongsTest extends TestCase { assertEquals("438", converter.reverse().convert(0666L)); } + public void testTryParse() { + tryParseAndAssertEquals(0L, "0"); + tryParseAndAssertEquals(0L, "-0"); + tryParseAndAssertEquals(1L, "1"); + tryParseAndAssertEquals(-1L, "-1"); + tryParseAndAssertEquals(8900L, "8900"); + tryParseAndAssertEquals(-8900L, "-8900"); + tryParseAndAssertEquals(MAX_VALUE, Long.toString(MAX_VALUE)); + tryParseAndAssertEquals(MIN_VALUE, Long.toString(MIN_VALUE)); + assertNull(Longs.tryParse("")); + assertNull(Longs.tryParse("-")); + assertNull(Longs.tryParse("+1")); + assertNull(Longs.tryParse("999999999999999999999999")); + assertNull("Max long + 1", + Longs.tryParse(BigInteger.valueOf(MAX_VALUE).add(BigInteger.ONE).toString())); + assertNull("Max long * 10", + Longs.tryParse(BigInteger.valueOf(MAX_VALUE).multiply(BigInteger.TEN).toString())); + assertNull("Min long - 1", + Longs.tryParse(BigInteger.valueOf(MIN_VALUE).subtract(BigInteger.ONE).toString())); + assertNull("Min long * 10", + Longs.tryParse(BigInteger.valueOf(MIN_VALUE).multiply(BigInteger.TEN).toString())); + assertNull(Longs.tryParse("\u0662\u06f3")); + } + /** * Applies {@link Longs#tryParse(String)} to the given string and asserts that * the result is as expected. diff --git a/guava-gwt/test/com/google/common/base/AsciiTest_gwt.java b/guava-gwt/test/com/google/common/base/AsciiTest_gwt.java index 518bd1aa4..e33c6c772 100644 --- a/guava-gwt/test/com/google/common/base/AsciiTest_gwt.java +++ b/guava-gwt/test/com/google/common/base/AsciiTest_gwt.java @@ -38,11 +38,6 @@ public void testEqualsIgnoreCase() throws Exception { testCase.testEqualsIgnoreCase(); } -public void testEqualsIgnoreCaseUnicodeEquivalence() throws Exception { - com.google.common.base.AsciiTest testCase = new com.google.common.base.AsciiTest(); - testCase.testEqualsIgnoreCaseUnicodeEquivalence(); -} - public void testToLowerCase() throws Exception { com.google.common.base.AsciiTest testCase = new com.google.common.base.AsciiTest(); testCase.testToLowerCase(); diff --git a/guava-gwt/test/com/google/common/base/EnumsTest_gwt.java b/guava-gwt/test/com/google/common/base/EnumsTest_gwt.java index bf5486b3c..40d81a5e8 100644 --- a/guava-gwt/test/com/google/common/base/EnumsTest_gwt.java +++ b/guava-gwt/test/com/google/common/base/EnumsTest_gwt.java @@ -57,24 +57,4 @@ public void testStringConverter_serialization() throws Exception { com.google.common.base.EnumsTest testCase = new com.google.common.base.EnumsTest(); testCase.testStringConverter_serialization(); } - -public void testValueOfFunction() throws Exception { - com.google.common.base.EnumsTest testCase = new com.google.common.base.EnumsTest(); - testCase.testValueOfFunction(); -} - -public void testValueOfFunction_caseSensitive() throws Exception { - com.google.common.base.EnumsTest testCase = new com.google.common.base.EnumsTest(); - testCase.testValueOfFunction_caseSensitive(); -} - -public void testValueOfFunction_equals() throws Exception { - com.google.common.base.EnumsTest testCase = new com.google.common.base.EnumsTest(); - testCase.testValueOfFunction_equals(); -} - -public void testValueOfFunction_nullWhenNoMatchingConstant() throws Exception { - com.google.common.base.EnumsTest testCase = new com.google.common.base.EnumsTest(); - testCase.testValueOfFunction_nullWhenNoMatchingConstant(); -} } diff --git a/guava-gwt/test/com/google/common/base/testModule.gwt.xml b/guava-gwt/test/com/google/common/base/testModule.gwt.xml index 9a7255048..6dcc75476 100644 --- a/guava-gwt/test/com/google/common/base/testModule.gwt.xml +++ b/guava-gwt/test/com/google/common/base/testModule.gwt.xml @@ -6,7 +6,7 @@ <inherits name="com.google.common.collect.Collect"/> <inherits name="com.google.common.testing.Testing"/> <inherits name="com.google.common.annotations.Annotations"/> - <inherits name="org.truth0.Truth"/> + <inherits name="com.google.common.truth.Truth"/> <entry-point class="com.google.common.base.TestModuleEntryPoint"/> <source path=""/> diff --git a/guava-gwt/test/com/google/common/cache/testModule.gwt.xml b/guava-gwt/test/com/google/common/cache/testModule.gwt.xml index 51e2bdca7..874969f00 100644 --- a/guava-gwt/test/com/google/common/cache/testModule.gwt.xml +++ b/guava-gwt/test/com/google/common/cache/testModule.gwt.xml @@ -8,7 +8,7 @@ <inherits name="com.google.common.collect.Collect"/> <inherits name="com.google.common.testing.Testing"/> <inherits name="com.google.common.util.concurrent.Concurrent"/> - <inherits name="org.truth0.Truth"/> + <inherits name="com.google.common.truth.Truth"/> <entry-point class="com.google.common.cache.TestModuleEntryPoint"/> <source path=""/> diff --git a/guava-gwt/test/com/google/common/collect/MultimapBuilderTest_gwt.java b/guava-gwt/test/com/google/common/collect/MultimapBuilderTest_gwt.java index 7efaa5e9b..d1e18cca6 100644 --- a/guava-gwt/test/com/google/common/collect/MultimapBuilderTest_gwt.java +++ b/guava-gwt/test/com/google/common/collect/MultimapBuilderTest_gwt.java @@ -23,11 +23,6 @@ public void testGenerics_gwtCompatible() throws Exception { testCase.testGenerics_gwtCompatible(); } -public void testSerialization() throws Exception { - com.google.common.collect.MultimapBuilderTest testCase = new com.google.common.collect.MultimapBuilderTest(); - testCase.testSerialization(); -} - public void testTreeKeys_gwtCompatible() throws Exception { com.google.common.collect.MultimapBuilderTest testCase = new com.google.common.collect.MultimapBuilderTest(); testCase.testTreeKeys_gwtCompatible(); diff --git a/guava-gwt/test/com/google/common/collect/MultisetsTest_gwt.java b/guava-gwt/test/com/google/common/collect/MultisetsTest_gwt.java index 409cac081..f758c48fe 100644 --- a/guava-gwt/test/com/google/common/collect/MultisetsTest_gwt.java +++ b/guava-gwt/test/com/google/common/collect/MultisetsTest_gwt.java @@ -83,19 +83,34 @@ public void testNewTreeMultisetNonGeneric() throws Exception { testCase.testNewTreeMultisetNonGeneric(); } -public void testRemoveEmptyOccurrences() throws Exception { +public void testRemoveEmptyOccurrencesIterable() throws Exception { com.google.common.collect.MultisetsTest testCase = new com.google.common.collect.MultisetsTest(); - testCase.testRemoveEmptyOccurrences(); + testCase.testRemoveEmptyOccurrencesIterable(); } -public void testRemoveOccurrences() throws Exception { +public void testRemoveEmptyOccurrencesMultiset() throws Exception { com.google.common.collect.MultisetsTest testCase = new com.google.common.collect.MultisetsTest(); - testCase.testRemoveOccurrences(); + testCase.testRemoveEmptyOccurrencesMultiset(); } -public void testRemoveOccurrencesEmpty() throws Exception { +public void testRemoveOccurrencesIterableEmpty() throws Exception { com.google.common.collect.MultisetsTest testCase = new com.google.common.collect.MultisetsTest(); - testCase.testRemoveOccurrencesEmpty(); + testCase.testRemoveOccurrencesIterableEmpty(); +} + +public void testRemoveOccurrencesMultiset() throws Exception { + com.google.common.collect.MultisetsTest testCase = new com.google.common.collect.MultisetsTest(); + testCase.testRemoveOccurrencesMultiset(); +} + +public void testRemoveOccurrencesMultisetEmpty() throws Exception { + com.google.common.collect.MultisetsTest testCase = new com.google.common.collect.MultisetsTest(); + testCase.testRemoveOccurrencesMultisetEmpty(); +} + +public void testRemoveOccurrencesMultisetIterable() throws Exception { + com.google.common.collect.MultisetsTest testCase = new com.google.common.collect.MultisetsTest(); + testCase.testRemoveOccurrencesMultisetIterable(); } public void testRetainEmptyOccurrences() throws Exception { diff --git a/guava-gwt/test/com/google/common/collect/testModule.gwt.xml b/guava-gwt/test/com/google/common/collect/testModule.gwt.xml index e21b7ba76..888b81ae4 100644 --- a/guava-gwt/test/com/google/common/collect/testModule.gwt.xml +++ b/guava-gwt/test/com/google/common/collect/testModule.gwt.xml @@ -9,7 +9,7 @@ <inherits name="com.google.common.collect.testing.google.Google"/> <inherits name="com.google.common.io.Io"/> <inherits name="com.google.common.testing.Testing"/> - <inherits name="org.truth0.Truth"/> + <inherits name="com.google.common.truth.Truth"/> <entry-point class="com.google.common.collect.TestModuleEntryPoint"/> <source path=""/> diff --git a/guava-gwt/test/com/google/common/collect/testing/Testing.gwt.xml b/guava-gwt/test/com/google/common/collect/testing/Testing.gwt.xml index 116b69f33..184e2129c 100644 --- a/guava-gwt/test/com/google/common/collect/testing/Testing.gwt.xml +++ b/guava-gwt/test/com/google/common/collect/testing/Testing.gwt.xml @@ -20,7 +20,7 @@ <inherits name="com.google.common.testing.Testing"/> - <inherits name="org.truth0.Truth"/> + <inherits name="com.google.common.truth.Truth"/> <inherits name="com.google.gwt.core.Core"/> diff --git a/guava-gwt/test/com/google/common/collect/testing/google/Google.gwt.xml b/guava-gwt/test/com/google/common/collect/testing/google/Google.gwt.xml index 2eccaf19f..6f4c38045 100644 --- a/guava-gwt/test/com/google/common/collect/testing/google/Google.gwt.xml +++ b/guava-gwt/test/com/google/common/collect/testing/google/Google.gwt.xml @@ -28,6 +28,6 @@ <inherits name="com.google.common.collect.testing.Testing"/> <inherits name="com.google.common.primitives.Primitives"/> <inherits name="com.google.common.testing.Testing"/> -<inherits name="org.truth0.Truth"/> +<inherits name="com.google.common.truth.Truth"/> <inherits name="com.google.gwt.core.Core"/> </module> diff --git a/guava-gwt/test/com/google/common/escape/testModule.gwt.xml b/guava-gwt/test/com/google/common/escape/testModule.gwt.xml index 72a367684..9eb2464dd 100644 --- a/guava-gwt/test/com/google/common/escape/testModule.gwt.xml +++ b/guava-gwt/test/com/google/common/escape/testModule.gwt.xml @@ -8,7 +8,6 @@ <inherits name="com.google.common.escape.testing.Testing"/> <inherits name="com.google.common.html.Html"/> <inherits name="com.google.common.testing.Testing"/> - <inherits name="com.google.common.annotations.Annotations"/> <entry-point class="com.google.common.escape.TestModuleEntryPoint"/> <source path=""/> diff --git a/guava-gwt/test/com/google/common/html/testModule.gwt.xml b/guava-gwt/test/com/google/common/html/testModule.gwt.xml index 45f8473da..0346ed12b 100644 --- a/guava-gwt/test/com/google/common/html/testModule.gwt.xml +++ b/guava-gwt/test/com/google/common/html/testModule.gwt.xml @@ -5,6 +5,7 @@ <inherits name="com.google.common.base.Base"/> <inherits name="com.google.common.escape.testing.Testing"/> <inherits name="com.google.common.html.Html"/> + <inherits name="com.google.common.truth.Truth"/> <entry-point class="com.google.common.html.TestModuleEntryPoint"/> <source path=""/> diff --git a/guava-gwt/test/com/google/common/math/testModule.gwt.xml b/guava-gwt/test/com/google/common/math/testModule.gwt.xml index 53c22b0d4..91255e321 100644 --- a/guava-gwt/test/com/google/common/math/testModule.gwt.xml +++ b/guava-gwt/test/com/google/common/math/testModule.gwt.xml @@ -2,12 +2,12 @@ <module> <inherits name="com.google.gwt.user.User"/> <inherits name="com.google.gwt.junit.JUnit"/> + <inherits name="com.google.common.annotations.Annotations"/> <inherits name="com.google.common.base.Base"/> <inherits name="com.google.common.collect.Collect"/> <inherits name="com.google.common.math.Math"/> <inherits name="com.google.common.testing.Testing"/> - <inherits name="org.truth0.Truth"/> - <inherits name="com.google.common.annotations.Annotations"/> + <inherits name="com.google.common.truth.Truth"/> <entry-point class="com.google.common.math.TestModuleEntryPoint"/> <source path=""/> diff --git a/guava-gwt/test/com/google/common/net/testModule.gwt.xml b/guava-gwt/test/com/google/common/net/testModule.gwt.xml index e9bd0a2dc..bc826a640 100644 --- a/guava-gwt/test/com/google/common/net/testModule.gwt.xml +++ b/guava-gwt/test/com/google/common/net/testModule.gwt.xml @@ -9,7 +9,7 @@ <inherits name="com.google.common.escape.testing.Testing"/> <inherits name="com.google.common.net.Net"/> <inherits name="com.google.common.testing.Testing"/> - <inherits name="org.truth0.Truth"/> + <inherits name="com.google.common.truth.Truth"/> <entry-point class="com.google.common.net.TestModuleEntryPoint"/> <source path=""/> diff --git a/guava-gwt/test/com/google/common/primitives/IntsTest_gwt.java b/guava-gwt/test/com/google/common/primitives/IntsTest_gwt.java index 550dd5c85..7021487a6 100644 --- a/guava-gwt/test/com/google/common/primitives/IntsTest_gwt.java +++ b/guava-gwt/test/com/google/common/primitives/IntsTest_gwt.java @@ -162,4 +162,9 @@ public void testToArray_withNull() throws Exception { com.google.common.primitives.IntsTest testCase = new com.google.common.primitives.IntsTest(); testCase.testToArray_withNull(); } + +public void testTryParse() throws Exception { + com.google.common.primitives.IntsTest testCase = new com.google.common.primitives.IntsTest(); + testCase.testTryParse(); +} } diff --git a/guava-gwt/test/com/google/common/primitives/LongsTest_gwt.java b/guava-gwt/test/com/google/common/primitives/LongsTest_gwt.java index 50525123a..b865b9eeb 100644 --- a/guava-gwt/test/com/google/common/primitives/LongsTest_gwt.java +++ b/guava-gwt/test/com/google/common/primitives/LongsTest_gwt.java @@ -167,4 +167,9 @@ public void testToByteArray() throws Exception { com.google.common.primitives.LongsTest testCase = new com.google.common.primitives.LongsTest(); testCase.testToByteArray(); } + +public void testTryParse() throws Exception { + com.google.common.primitives.LongsTest testCase = new com.google.common.primitives.LongsTest(); + testCase.testTryParse(); +} } diff --git a/guava-gwt/test/com/google/common/primitives/testModule.gwt.xml b/guava-gwt/test/com/google/common/primitives/testModule.gwt.xml index 8e7f7e367..4bec90064 100644 --- a/guava-gwt/test/com/google/common/primitives/testModule.gwt.xml +++ b/guava-gwt/test/com/google/common/primitives/testModule.gwt.xml @@ -5,7 +5,7 @@ <inherits name="com.google.common.collect.testing.Testing"/> <inherits name="com.google.common.primitives.Primitives"/> <inherits name="com.google.common.testing.Testing"/> - <inherits name="org.truth0.Truth"/> + <inherits name="com.google.common.truth.Truth"/> <entry-point class="com.google.common.primitives.TestModuleEntryPoint"/> <source path=""/> diff --git a/guava-gwt/test/com/google/common/testing/testModule.gwt.xml b/guava-gwt/test/com/google/common/testing/testModule.gwt.xml index 0ef66da99..cab3664b4 100644 --- a/guava-gwt/test/com/google/common/testing/testModule.gwt.xml +++ b/guava-gwt/test/com/google/common/testing/testModule.gwt.xml @@ -4,7 +4,7 @@ <inherits name="com.google.gwt.junit.JUnit"/> <inherits name="com.google.common.collect.Collect"/> <inherits name="com.google.common.testing.Testing"/> - <inherits name="org.truth0.Truth"/> + <inherits name="com.google.common.truth.Truth"/> <entry-point class="com.google.common.testing.TestModuleEntryPoint"/> <source path=""/> |