Make PrimitiveFloatArraySubjectTest runnable under J2CL.

- Concat float values into expected error message to work around precision lost when converting to js
- Use constants and only test to make sure it matches Math.nextAFter() in java to work around 'Math.nextAFter' not available in J2CL
- Have custom implementations of comparing float array rather than using Arrays.equal()

RELNOTES=n/a

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181373244
diff --git a/core/src/main/java/com/google/common/truth/Platform.java b/core/src/main/java/com/google/common/truth/Platform.java
index 8f487f7..ba639e5 100644
--- a/core/src/main/java/com/google/common/truth/Platform.java
+++ b/core/src/main/java/com/google/common/truth/Platform.java
@@ -139,6 +139,10 @@
     return Double.toString(value);
   }
 
+  static String floatToString(float value) {
+    return Float.toString(value);
+  }
+
   /** Returns a human readable string representation of the throwable's stack trace. */
   static String getStackTraceAsString(Throwable throwable) {
     return Throwables.getStackTraceAsString(throwable);
diff --git a/core/src/main/java/com/google/common/truth/PrimitiveFloatArraySubject.java b/core/src/main/java/com/google/common/truth/PrimitiveFloatArraySubject.java
index 34fa6c8..a5c7bd1 100644
--- a/core/src/main/java/com/google/common/truth/PrimitiveFloatArraySubject.java
+++ b/core/src/main/java/com/google/common/truth/PrimitiveFloatArraySubject.java
@@ -22,6 +22,7 @@
 import static com.google.common.truth.FloatSubject.checkTolerance;
 import static com.google.common.truth.MathUtil.equalWithinTolerance;
 import static com.google.common.truth.MathUtil.notEqualWithinTolerance;
+import static com.google.common.truth.Platform.floatToString;
 
 import com.google.common.collect.Iterables;
 import com.google.common.primitives.Floats;
@@ -48,8 +49,8 @@
   }
 
   @Override
-  protected List<Float> listRepresentation() {
-    return Floats.asList(actual());
+  protected List<String> listRepresentation() {
+    return floatArrayAsString(actual());
   }
 
   /**
@@ -84,8 +85,8 @@
     }
     try {
       float[] expectedArray = (float[]) expected;
-      if (!Arrays.equals(actual, expectedArray)) {
-        fail("is equal to", Floats.asList(expectedArray));
+      if (!arrayEquals(actual, expectedArray)) {
+        fail("is equal to", floatArrayAsString(expectedArray));
       }
     } catch (ClassCastException e) {
       failWithBadType(expected);
@@ -117,7 +118,7 @@
       if (expectedArray.length != actual.length) {
         failWithRawMessage(
             "Arrays are of different lengths. expected: %s, actual %s",
-            Floats.asList(expectedArray), Floats.asList(actual));
+            floatArrayAsString(expectedArray), floatArrayAsString(actual));
         return;
       }
       List<Integer> unequalIndices = new ArrayList<>();
@@ -128,7 +129,7 @@
       }
 
       if (!unequalIndices.isEmpty()) {
-        fail("is equal to", Floats.asList(expectedArray));
+        fail("is equal to", floatArrayAsString(expectedArray));
         return;
       }
     } catch (ClassCastException e) {
@@ -155,9 +156,9 @@
     float[] actual = actual();
     try {
       float[] expectedArray = (float[]) expected;
-      if (actual == expected || Arrays.equals(actual, expectedArray)) {
+      if (actual == expected || arrayEquals(actual, expectedArray)) {
         failWithRawMessage(
-            "%s unexpectedly equal to %s.", actualAsString(), Floats.asList(expectedArray));
+            "%s unexpectedly equal to %s.", actualAsString(), floatArrayAsString(expectedArray));
       }
     } catch (ClassCastException ignored) {
       // If it's not float[] then it's not equal and the test passes.
@@ -185,7 +186,7 @@
       float[] expected = (float[]) expectedArray;
       if (actual == expected) {
         failWithRawMessage(
-            "%s unexpectedly equal to %s.", actualAsString(), Floats.asList(expected));
+            "%s unexpectedly equal to %s.", actualAsString(), floatArrayAsString(expected));
         return;
       }
       if (expected.length != actual.length) {
@@ -199,7 +200,7 @@
       }
       if (unequalIndices.isEmpty()) {
         failWithRawMessage(
-            "%s unexpectedly equal to %s.", actualAsString(), Floats.asList(expected));
+            "%s unexpectedly equal to %s.", actualAsString(), floatArrayAsString(expected));
         return;
       }
     } catch (ClassCastException ignored) {
@@ -397,7 +398,7 @@
 
         @Override
         public boolean compare(Float actual, Number expected) {
-          return actual.equals(checkedToFloat(expected));
+          return Float.floatToIntBits(actual) == Float.floatToIntBits(checkedToFloat(expected));
         }
 
         @Override
@@ -513,8 +514,62 @@
   }
 
   private IterableSubject iterableSubject() {
-    return internalCustomName() != null
-        ? check().that(listRepresentation()).named(internalCustomName())
-        : check().that(listRepresentation());
+    IterableSubject result =
+        check().about(iterablesWithCustomFloatToString()).that(Floats.asList(actual()));
+    return internalCustomName() != null ? result.named(internalCustomName()) : result;
+  }
+
+  /*
+   * TODO(cpovirk): Should we make Floats.asList().toString() smarter rather than do all this?
+   *
+   * TODO(cpovirk): Or find a general solution for this and MultimapSubject.IterableEntries. But
+   * note that here we don't use _exactly_ PrimitiveFloatArraySubject.this.toString(), as that
+   * contains "float[]." Or maybe we should stop including that in
+   * PrimitiveFloatArraySubject.this.toString(), too, someday?
+   */
+  private Factory<IterableSubject, Iterable<?>> iterablesWithCustomFloatToString() {
+    return new Factory<IterableSubject, Iterable<?>>() {
+      @Override
+      public IterableSubject createSubject(FailureMetadata metadata, Iterable<?> actual) {
+        return new IterableSubjectWithInheritedToString(metadata, actual);
+      }
+    };
+  }
+
+  private final class IterableSubjectWithInheritedToString extends IterableSubject {
+    IterableSubjectWithInheritedToString(FailureMetadata metadata, Iterable<?> actual) {
+      super(metadata, actual);
+    }
+
+    @Override
+    protected String actualCustomStringRepresentation() {
+      return floatArrayAsString(PrimitiveFloatArraySubject.this.actual()).toString();
+    }
+  }
+
+  private static boolean arrayEquals(float[] left, float[] right) {
+    if (left == right) {
+      return true;
+    }
+    if (left == null || right == null) {
+      return false;
+    }
+    if (left.length != right.length) {
+      return false;
+    }
+    for (int i = 0; i < left.length; i++) {
+      if (Float.floatToIntBits(left[i]) != Float.floatToIntBits(right[i])) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  static List<String> floatArrayAsString(float[] items) {
+    List<String> itemAsStrings = new ArrayList<String>(items.length);
+    for (float item : items) {
+      itemAsStrings.add(floatToString(item));
+    }
+    return itemAsStrings;
   }
 }
diff --git a/core/src/main/java/com/google/common/truth/super/com/google/common/truth/Platform.java b/core/src/main/java/com/google/common/truth/super/com/google/common/truth/Platform.java
index 91e25c9..272da6b 100644
--- a/core/src/main/java/com/google/common/truth/super/com/google/common/truth/Platform.java
+++ b/core/src/main/java/com/google/common/truth/super/com/google/common/truth/Platform.java
@@ -16,9 +16,8 @@
 package com.google.common.truth;
 
 import static com.google.common.truth.StringUtil.format;
-import static java.lang.Double.NEGATIVE_INFINITY;
-import static java.lang.Double.POSITIVE_INFINITY;
 import static java.lang.Double.parseDouble;
+import static java.lang.Float.parseFloat;
 import static jsinterop.annotations.JsPackage.GLOBAL;
 
 import com.google.common.truth.Truth.AssertionErrorWithCause;
@@ -85,9 +84,9 @@
 
   static String doubleToString(double value) {
     // This probably doesn't match Java perfectly, but we do our best.
-    if (value == POSITIVE_INFINITY) {
+    if (value == Double.POSITIVE_INFINITY) {
       return "Infinity";
-    } else if (value == NEGATIVE_INFINITY) {
+    } else if (value == Double.NEGATIVE_INFINITY) {
       return "-Infinity";
     } else if (value == 0 && 1 / value < 0) {
       return "-0.0";
@@ -99,6 +98,24 @@
     }
   }
 
+  static String floatToString(float value) {
+    // This probably doesn't match Java perfectly, but we do our best.
+    if (value == Float.POSITIVE_INFINITY) {
+      return "Infinity";
+    } else if (value == Float.NEGATIVE_INFINITY) {
+      return "-Infinity";
+    } else if (value == 0 && 1 / value < 0) {
+      return "-0.0";
+    } else if (value == 0) {
+      return "0.0";
+    } else {
+      // TODO(cpovirk): Would it make more sense to pass `undefined` for the locale? But how?
+      // Then again, we're already hardcoding "Infinity," an English word, above....
+      String result = ((Number) (Object) value).toLocaleString("en-US", JavaLikeOptions.INSTANCE);
+      return (parseFloat(result) == value) ? result : Float.toString(value);
+    }
+  }
+
   /** Tests if current platform is Android which is always false. */
   static boolean isAndroid() {
     return false;
diff --git a/core/src/test/java/com/google/common/truth/PrimitiveFloatArraySubjectTest.java b/core/src/test/java/com/google/common/truth/PrimitiveFloatArraySubjectTest.java
index e0a389c..ec58d76 100644
--- a/core/src/test/java/com/google/common/truth/PrimitiveFloatArraySubjectTest.java
+++ b/core/src/test/java/com/google/common/truth/PrimitiveFloatArraySubjectTest.java
@@ -15,6 +15,7 @@
  */
 package com.google.common.truth;
 
+import static com.google.common.truth.StringUtil.format;
 import static com.google.common.truth.Truth.assertThat;
 import static java.lang.Float.NEGATIVE_INFINITY;
 import static java.lang.Float.NaN;
@@ -22,12 +23,12 @@
 import static java.lang.Math.nextAfter;
 import static org.junit.Assert.fail;
 
+import com.google.common.annotations.GwtIncompatible;
 import com.google.common.primitives.Doubles;
 import com.google.common.primitives.Floats;
 import com.google.common.primitives.Longs;
 import java.math.BigDecimal;
 import java.math.BigInteger;
-import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
@@ -38,10 +39,30 @@
  * @author Christian Gruber (cgruber@israfil.net)
  */
 @RunWith(JUnit4.class)
-public class PrimitiveFloatArraySubjectTest {
-  @Rule public final ExpectFailure expectFailure = new ExpectFailure();
+public class PrimitiveFloatArraySubjectTest extends BaseSubjectTestCase {
   private static final float DEFAULT_TOLERANCE = 0.000005f;
 
+  private static final float JUST_OVER_2POINT2 = 2.2000003f;
+  private static final float JUST_OVER_3POINT3 = 3.3000002f;
+  private static final float TOLERABLE_3POINT3 = 3.3000047f;
+  private static final float INTOLERABLE_3POINT3 = 3.3000052f;
+  private static final float UNDER_LONG_MIN = -9.223373E18f;
+  private static final float TOLERABLE_TWO = 2.0000048f;
+  private static final float INTOLERABLE_TWO = 2.0000052f;
+
+  @Test
+  @GwtIncompatible("Math.nextAfter")
+  public void testFloatConstants_matchNextAfter() {
+    assertThat(nextAfter(2.2f, POSITIVE_INFINITY)).isEqualTo(JUST_OVER_2POINT2);
+    assertThat(nextAfter(3.3f, POSITIVE_INFINITY)).isEqualTo(JUST_OVER_3POINT3);
+    assertThat(nextAfter(3.3f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY)).isEqualTo(TOLERABLE_3POINT3);
+    assertThat(nextAfter(3.3f + DEFAULT_TOLERANCE, POSITIVE_INFINITY))
+        .isEqualTo(INTOLERABLE_3POINT3);
+    assertThat(nextAfter(Long.MIN_VALUE, NEGATIVE_INFINITY)).isEqualTo(UNDER_LONG_MIN);
+    assertThat(nextAfter(2.0f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY)).isEqualTo(TOLERABLE_TWO);
+    assertThat(nextAfter(2.0f + DEFAULT_TOLERANCE, POSITIVE_INFINITY)).isEqualTo(INTOLERABLE_TWO);
+  }
+
   @Test
   public void isEqualTo_WithoutToleranceParameter_Success() {
     assertThat(array(2.2f, 5.4f, POSITIVE_INFINITY, NEGATIVE_INFINITY, NaN, 0.0f, -0.0f))
@@ -50,11 +71,11 @@
 
   @Test
   public void isEqualTo_WithoutToleranceParameter_Fail_NotEqual() {
-    float justOverTwoPointTwo = nextAfter(2.2f, POSITIVE_INFINITY);
-    expectFailure.whenTesting().that(array(2.2f)).isEqualTo(array(justOverTwoPointTwo));
+    expectFailure.whenTesting().that(array(2.2f)).isEqualTo(array(JUST_OVER_2POINT2));
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
-        .isEqualTo("Not true that <(float[]) [2.2]> is equal to <[" + justOverTwoPointTwo + "]>");
+        .isEqualTo(
+            format("Not true that <(float[]) [%s]> is equal to <[%s]>", 2.2f, JUST_OVER_2POINT2));
   }
 
   @Test
@@ -62,7 +83,10 @@
     expectFailure.whenTesting().that(array(2.2f, 3.3f)).isEqualTo(array(3.3f, 2.2f));
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
-        .isEqualTo("Not true that <(float[]) [2.2, 3.3]> is equal to <[3.3, 2.2]>");
+        .isEqualTo(
+            format(
+                "Not true that <(float[]) [%s, %s]> is equal to <[%s, %s]>",
+                2.2f, 3.3f, 3.3f, 2.2f));
   }
 
   @Test
@@ -70,7 +94,10 @@
     expectFailure.whenTesting().that(array(2.2f, 3.3f)).isEqualTo(array(2.2f, 3.3f, 4.4f));
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
-        .isEqualTo("Not true that <(float[]) [2.2, 3.3]> is equal to <[2.2, 3.3, 4.4]>");
+        .isEqualTo(
+            format(
+                "Not true that <(float[]) [%s, %s]> is equal to <[%s, %s, %s]>",
+                2.2f, 3.3f, 2.2f, 3.3f, 4.4f));
   }
 
   @Test
@@ -78,7 +105,8 @@
     expectFailure.whenTesting().that(array(2.2f, 3.3f)).isEqualTo(array(2.2f));
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
-        .isEqualTo("Not true that <(float[]) [2.2, 3.3]> is equal to <[2.2]>");
+        .isEqualTo(
+            format("Not true that <(float[]) [%s, %s]> is equal to <[%s]>", 2.2f, 3.3f, 2.2f));
   }
 
   @Test
@@ -106,23 +134,22 @@
   @SuppressWarnings("deprecation") // testing deprecated method
   @Test
   public void isEqualTo_WithToleranceParameter_ApproximatelyEquals() {
-    assertThat(array(2.2f, 3.3f))
-        .isEqualTo(
-            array(2.2f, nextAfter(3.3f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY)), DEFAULT_TOLERANCE);
+    assertThat(array(2.2f, 3.3f)).isEqualTo(array(2.2f, TOLERABLE_3POINT3), DEFAULT_TOLERANCE);
   }
 
   @SuppressWarnings("deprecation") // testing deprecated method
   @Test
   public void isEqualTo_WithToleranceParameter_FailNotQuiteApproximatelyEquals() {
-    float roughly3point3 = nextAfter(3.3f + DEFAULT_TOLERANCE, POSITIVE_INFINITY);
     expectFailure
         .whenTesting()
         .that(array(2.2f, 3.3f))
-        .isEqualTo(array(2.2f, roughly3point3), DEFAULT_TOLERANCE);
+        .isEqualTo(array(2.2f, INTOLERABLE_3POINT3), DEFAULT_TOLERANCE);
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> is equal to <[2.2, " + roughly3point3 + "]>");
+            format(
+                "Not true that <(float[]) [%s, %s]> is equal to <[%s, %s]>",
+                2.2f, 3.3f, 2.2f, INTOLERABLE_3POINT3));
   }
 
   @SuppressWarnings("deprecation") // testing deprecated method
@@ -134,7 +161,10 @@
         .isEqualTo(array(3.3f, 2.2f), DEFAULT_TOLERANCE);
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
-        .isEqualTo("Not true that <(float[]) [2.2, 3.3]> is equal to <[3.3, 2.2]>");
+        .isEqualTo(
+            format(
+                "Not true that <(float[]) [%s, %s]> is equal to <[%s, %s]>",
+                2.2f, 3.3f, 3.3f, 2.2f));
   }
 
   @SuppressWarnings("deprecation") // testing deprecated method
@@ -146,7 +176,10 @@
         .isEqualTo(array(2.2f, 3.3f, 1.1f), DEFAULT_TOLERANCE);
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
-        .isEqualTo("Arrays are of different lengths. expected: [2.2, 3.3, 1.1], actual [2.2, 3.3]");
+        .isEqualTo(
+            format(
+                "Arrays are of different lengths. expected: [%s, %s, %s], actual [%s, %s]",
+                2.2f, 3.3f, 1.1f, 2.2f, 3.3f));
   }
 
   @SuppressWarnings("deprecation") // testing deprecated method
@@ -155,7 +188,10 @@
     expectFailure.whenTesting().that(array(2.2f, 3.3f)).isEqualTo(array(2.2f), DEFAULT_TOLERANCE);
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
-        .isEqualTo("Arrays are of different lengths. expected: [2.2], actual [2.2, 3.3]");
+        .isEqualTo(
+            format(
+                "Arrays are of different lengths. expected: [%s], actual [%s, %s]",
+                2.2f, 2.2f, 3.3f));
   }
 
   @SuppressWarnings("deprecation") // testing deprecated method
@@ -179,7 +215,10 @@
         .isEqualTo(array(2.2f, POSITIVE_INFINITY), DEFAULT_TOLERANCE);
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
-        .isEqualTo("Not true that <(float[]) [2.2, Infinity]> is equal to <[2.2, Infinity]>");
+        .isEqualTo(
+            format(
+                "Not true that <(float[]) [%s, Infinity]> is equal to <[%s, Infinity]>",
+                2.2f, 2.2f));
   }
 
   @SuppressWarnings("deprecation") // testing deprecated method
@@ -198,7 +237,10 @@
         .isEqualTo(array(2.2f, POSITIVE_INFINITY), DEFAULT_TOLERANCE);
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
-        .isEqualTo("Not true that <(float[]) [2.2, 3.3]> is equal to <[2.2, Infinity]>");
+        .isEqualTo(
+            format(
+                "Not true that <(float[]) [%s, %s]> is equal to <[%s, Infinity]>",
+                2.2f, 3.3f, 2.2f));
   }
 
   @SuppressWarnings("deprecation") // testing deprecated method
@@ -210,7 +252,10 @@
         .isEqualTo(array(POSITIVE_INFINITY), DEFAULT_TOLERANCE);
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
-        .isEqualTo("Arrays are of different lengths. expected: [Infinity], actual [2.2, 3.3]");
+        .isEqualTo(
+            format(
+                "Arrays are of different lengths. expected: [Infinity], actual [%s, %s]",
+                2.2f, 3.3f));
   }
 
   @SuppressWarnings("deprecation") // testing deprecated method
@@ -231,13 +276,15 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "<(float[]) [2.2, 5.4, Infinity, -Infinity, NaN, 0.0, -0.0]> unexpectedly equal to "
-                + "[2.2, 5.4, Infinity, -Infinity, NaN, 0.0, -0.0].");
+            format(
+                "<(float[]) [%s, %s, Infinity, -Infinity, NaN, 0.0, -0.0]> unexpectedly equal to "
+                    + "[%s, %s, Infinity, -Infinity, NaN, 0.0, -0.0].",
+                2.2f, 5.4f, 2.2f, 5.4f));
   }
 
   @Test
   public void isNotEqualTo_WithoutToleranceParameter_Success_NotEqual() {
-    assertThat(array(2.2f)).isNotEqualTo(array(nextAfter(2.2f, POSITIVE_INFINITY)));
+    assertThat(array(2.2f)).isNotEqualTo(array(JUST_OVER_2POINT2));
   }
 
   @Test
@@ -298,28 +345,29 @@
         .isNotEqualTo(array(2.2f, 3.3f), DEFAULT_TOLERANCE);
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
-        .isEqualTo("<(float[]) [2.2, 3.3]> unexpectedly equal to [2.2, 3.3].");
+        .isEqualTo(
+            format("<(float[]) [%s, %s]> unexpectedly equal to [%s, %s].", 2.2f, 3.3f, 2.2f, 3.3f));
   }
 
   @SuppressWarnings("deprecation") // testing deprecated method
   @Test
   public void isNotEqualTo_WithToleranceParameter_FailApproximatelyEquals() {
-    float roughly3point3 = nextAfter(3.3f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY);
     expectFailure
         .whenTesting()
         .that(array(2.2f, 3.3f))
-        .isNotEqualTo(array(2.2f, roughly3point3), DEFAULT_TOLERANCE);
+        .isNotEqualTo(array(2.2f, TOLERABLE_3POINT3), DEFAULT_TOLERANCE);
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
-        .isEqualTo("<(float[]) [2.2, 3.3]> unexpectedly equal to [2.2, " + roughly3point3 + "].");
+        .isEqualTo(
+            format(
+                "<(float[]) [%s, %s]> unexpectedly equal to [%s, %s].",
+                2.2f, 3.3f, 2.2f, TOLERABLE_3POINT3));
   }
 
   @SuppressWarnings("deprecation") // testing deprecated method
   @Test
   public void isNotEqualTo_WithToleranceParameter_NotQuiteApproximatelyEquals() {
-    assertThat(array(2.2f, 3.3f))
-        .isNotEqualTo(
-            array(2.2f, nextAfter(3.3f + DEFAULT_TOLERANCE, POSITIVE_INFINITY)), DEFAULT_TOLERANCE);
+    assertThat(array(2.2f, 3.3f)).isNotEqualTo(array(2.2f, INTOLERABLE_3POINT3), DEFAULT_TOLERANCE);
   }
 
   @SuppressWarnings("deprecation") // testing deprecated method
@@ -329,7 +377,8 @@
     expectFailure.whenTesting().that(same).isNotEqualTo(same, DEFAULT_TOLERANCE);
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
-        .isEqualTo("<(float[]) [2.2, 3.3]> unexpectedly equal to [2.2, 3.3].");
+        .isEqualTo(
+            format("<(float[]) [%s, %s]> unexpectedly equal to [%s, %s].", 2.2f, 3.3f, 2.2f, 3.3f));
   }
 
   @SuppressWarnings("deprecation") // testing deprecated method
@@ -346,7 +395,8 @@
     expectFailure.whenTesting().that(same).isNotEqualTo(same, DEFAULT_TOLERANCE);
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
-        .isEqualTo("<(float[]) [2.2, Infinity]> unexpectedly equal to [2.2, Infinity].");
+        .isEqualTo(
+            format("<(float[]) [%s, Infinity]> unexpectedly equal to [%s, Infinity].", 2.2f, 2.2f));
   }
 
   @SuppressWarnings("deprecation") // testing deprecated method
@@ -374,25 +424,23 @@
 
   @Test
   public void hasValuesWithinOf_ApproximatelyEquals() {
-    assertThat(array(2.2f, 3.3f))
-        .hasValuesWithin(DEFAULT_TOLERANCE)
-        .of(2.2f, nextAfter(3.3f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY));
+    assertThat(array(2.2f, 3.3f)).hasValuesWithin(DEFAULT_TOLERANCE).of(2.2f, TOLERABLE_3POINT3);
   }
 
   @Test
   public void hasValuesWithinOf_FailNotQuiteApproximatelyEquals() {
-    float roughly3point3 = nextAfter(3.3f + DEFAULT_TOLERANCE, POSITIVE_INFINITY);
     expectFailure
         .whenTesting()
         .that(array(2.2f, 3.3f))
         .hasValuesWithin(DEFAULT_TOLERANCE)
-        .of(2.2f, roughly3point3);
+        .of(2.2f, INTOLERABLE_3POINT3);
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values within 5.0E-6 of <[2.2, "
-                + roughly3point3
-                + "]>. It differs at indexes <[1]>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values within %s of <[%s, %s]>."
+                    + " It differs at indexes <[1]>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 2.2f, INTOLERABLE_3POINT3));
   }
 
   @Test
@@ -405,8 +453,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values within 5.0E-6 of <[3.3, 2.2]>."
-                + " It differs at indexes <[0, 1]>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values within %s of <[%s, %s]>."
+                    + " It differs at indexes <[0, 1]>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 3.3f, 2.2f));
   }
 
   @Test
@@ -419,8 +469,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values within 5.0E-6 of <[2.2, 3.3, 1.1]>."
-                + " Expected length <3> but got <2>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values within %s of <[%s, %s, %s]>."
+                    + " Expected length <3> but got <2>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 2.2f, 3.3f, 1.1f));
   }
 
   @Test
@@ -429,8 +481,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values within 5.0E-6 of <[2.2]>."
-                + " Expected length <1> but got <2>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values within %s of <[%s]>."
+                    + " Expected length <1> but got <2>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 2.2f));
   }
 
   @Test
@@ -443,8 +497,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, Infinity]> has values within 5.0E-6 of"
-                + " <[2.2, Infinity]>. It differs at indexes <[1]>");
+            format(
+                "Not true that <(float[]) [%s, Infinity]> has values within %s of"
+                    + " <[%s, Infinity]>. It differs at indexes <[1]>",
+                2.2f, DEFAULT_TOLERANCE, 2.2f));
   }
 
   @Test
@@ -454,8 +510,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, Infinity]> has values within 5.0E-6 of"
-                + " <[2.2, Infinity]>. It differs at indexes <[1]>");
+            format(
+                "Not true that <(float[]) [%s, Infinity]> has values within %s of"
+                    + " <[%s, Infinity]>. It differs at indexes <[1]>",
+                2.2f, DEFAULT_TOLERANCE, 2.2f));
   }
 
   @Test
@@ -468,8 +526,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values within 5.0E-6 of <[2.2, Infinity]>."
-                + " It differs at indexes <[1]>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values within %s of <[%s, Infinity]>."
+                    + " It differs at indexes <[1]>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 2.2f));
   }
 
   @Test
@@ -482,8 +542,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values within 5.0E-6 of <[Infinity]>."
-                + " Expected length <1> but got <2>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values within %s of <[Infinity]>."
+                    + " Expected length <1> but got <2>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE));
   }
 
   @Test
@@ -492,8 +554,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [NaN]> has values within 5.0E-6 of <[NaN]>."
-                + " It differs at indexes <[0]>");
+            format(
+                "Not true that <(float[]) [NaN]> has values within %s of <[NaN]>."
+                    + " It differs at indexes <[0]>",
+                DEFAULT_TOLERANCE));
   }
 
   @Test
@@ -522,7 +586,9 @@
       assertThat(array(3.3f, 2.2f)).hasValuesWithin(-0.001f).of(3.3f, 2.2f);
       fail("Expected IllegalArgumentException to be thrown");
     } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessageThat().isEqualTo("tolerance (-0.001) cannot be negative");
+      assertThat(e)
+          .hasMessageThat()
+          .isEqualTo(format("tolerance (%s) cannot be negative", -0.001f));
     }
   }
 
@@ -551,23 +617,23 @@
   public void hasValuesWithinOfElementsIn_ApproximatelyEquals() {
     assertThat(array(2.2f, 3.3f))
         .hasValuesWithin(DEFAULT_TOLERANCE)
-        .ofElementsIn(Floats.asList(2.2f, nextAfter(3.3f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY)));
+        .ofElementsIn(Floats.asList(2.2f, TOLERABLE_3POINT3));
   }
 
   @Test
   public void hasValuesWithinOfElementsIn_FailNotQuiteApproximatelyEquals() {
-    float roughly3point3 = nextAfter(3.3f + DEFAULT_TOLERANCE, POSITIVE_INFINITY);
     expectFailure
         .whenTesting()
         .that(array(2.2f, 3.3f))
         .hasValuesWithin(DEFAULT_TOLERANCE)
-        .ofElementsIn(Floats.asList(2.2f, roughly3point3));
+        .ofElementsIn(Floats.asList(2.2f, INTOLERABLE_3POINT3));
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values within 5.0E-6 of <[2.2, "
-                + roughly3point3
-                + "]>. It differs at indexes <[1]>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values within %s of"
+                    + " <[%s, %s]>. It differs at indexes <[1]>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 2.2f, INTOLERABLE_3POINT3));
   }
 
   @Test
@@ -580,8 +646,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values within 5.0E-6 of <[3.3, 2.2]>."
-                + " It differs at indexes <[0, 1]>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values within %s of <[%s, %s]>."
+                    + " It differs at indexes <[0, 1]>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 3.3f, 2.2f));
   }
 
   @Test
@@ -594,8 +662,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values within 5.0E-6 of <[2.2, 3.3, 1.1]>."
-                + " Expected length <3> but got <2>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values within %s of <[%s, %s, %s]>."
+                    + " Expected length <3> but got <2>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 2.2f, 3.3f, 1.1f));
   }
 
   @Test
@@ -608,8 +678,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values within 5.0E-6 of <[2.2]>."
-                + " Expected length <1> but got <2>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values within %s of <[%s]>."
+                    + " Expected length <1> but got <2>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 2.2f));
   }
 
   @Test
@@ -622,8 +694,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, Infinity]> has values within 5.0E-6 of"
-                + " <[2.2, Infinity]>. It differs at indexes <[1]>");
+            format(
+                "Not true that <(float[]) [%s, Infinity]> has values within %s of"
+                    + " <[%s, Infinity]>. It differs at indexes <[1]>",
+                2.2f, DEFAULT_TOLERANCE, 2.2f));
   }
 
   @Test
@@ -636,8 +710,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values within 5.0E-6 of <[2.2, Infinity]>."
-                + " It differs at indexes <[1]>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values within %s of <[%s, Infinity]>."
+                    + " It differs at indexes <[1]>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 2.2f));
   }
 
   @Test
@@ -650,8 +726,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values within 5.0E-6 of <[Infinity]>."
-                + " Expected length <1> but got <2>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values within %s of <[Infinity]>."
+                    + " Expected length <1> but got <2>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE));
   }
 
   @Test
@@ -664,8 +742,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [NaN]> has values within 5.0E-6 of <[NaN]>."
-                + " It differs at indexes <[0]>");
+            format(
+                "Not true that <(float[]) [NaN]> has values within %s of <[NaN]>."
+                    + " It differs at indexes <[0]>",
+                DEFAULT_TOLERANCE));
   }
 
   @Test
@@ -698,7 +778,9 @@
           .ofElementsIn(Floats.asList(3.3f, 2.2f));
       fail("Expected IllegalArgumentException to be thrown");
     } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessageThat().isEqualTo("tolerance (-0.001) cannot be negative");
+      assertThat(e)
+          .hasMessageThat()
+          .isEqualTo(format("tolerance (%s) cannot be negative", -0.001f));
     }
   }
 
@@ -725,24 +807,25 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values not within 5.0E-6 of <[2.2, 3.3]>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values not within %s of <[%s, %s]>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 2.2f, 3.3f));
   }
 
   @Test
   @SuppressWarnings("deprecation") // testing deprecated method
   public void hasValuesNotWithinOf_FailApproximatelyEquals() {
-    float roughly3point3 = nextAfter(3.3f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY);
     expectFailure
         .whenTesting()
         .that(array(2.2f, 3.3f))
         .hasValuesNotWithin(DEFAULT_TOLERANCE)
-        .of(2.2f, roughly3point3);
+        .of(2.2f, TOLERABLE_3POINT3);
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values not within 5.0E-6 of <[2.2, "
-                + roughly3point3
-                + "]>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values not within %s of <[%s, %s]>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 2.2f, TOLERABLE_3POINT3));
   }
 
   @Test
@@ -750,7 +833,7 @@
   public void hasValuesNotWithinOf_NotQuiteApproximatelyEquals() {
     assertThat(array(2.2f, 3.3f))
         .hasValuesNotWithin(DEFAULT_TOLERANCE)
-        .of(2.2f, nextAfter(3.3f + DEFAULT_TOLERANCE, POSITIVE_INFINITY));
+        .of(2.2f, INTOLERABLE_3POINT3);
   }
 
   @Test
@@ -761,7 +844,9 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values not within 5.0E-6 of <[2.2, 3.3]>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values not within %s of <[%s, %s]>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 2.2f, 3.3f));
   }
 
   @Test
@@ -775,8 +860,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, Infinity]> has values not within 5.0E-6 of"
-                + " <[2.2, Infinity]>");
+            format(
+                "Not true that <(float[]) [%s, Infinity]> has values not within %s of"
+                    + " <[%s, Infinity]>",
+                2.2f, DEFAULT_TOLERANCE, 2.2f));
   }
 
   @Test
@@ -787,8 +874,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, Infinity]> has values not within 5.0E-6 of"
-                + " <[2.2, Infinity]>");
+            format(
+                "Not true that <(float[]) [%s, Infinity]> has values not within %s of"
+                    + " <[%s, Infinity]>",
+                2.2f, DEFAULT_TOLERANCE, 2.2f));
   }
 
   @Test
@@ -802,8 +891,9 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values not within 5.0E-6 of"
-                + " <[2.2, Infinity]>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values not within %s of <[%s, Infinity]>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 2.2f));
   }
 
   @Test
@@ -818,7 +908,10 @@
     expectFailure.whenTesting().that(array(NaN)).hasValuesNotWithin(DEFAULT_TOLERANCE).of(NaN);
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
-        .isEqualTo("Not true that <(float[]) [NaN]> has values not within 5.0E-6 of <[NaN]>");
+        .isEqualTo(
+            format(
+                "Not true that <(float[]) [NaN]> has values not within %s of <[NaN]>",
+                DEFAULT_TOLERANCE));
   }
 
   @Test
@@ -850,7 +943,9 @@
       assertThat(array(3.3f, 2.2f)).hasValuesNotWithin(-0.001f).of(3.3f, 2.2f);
       fail("Expected IllegalArgumentException to be thrown");
     } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessageThat().isEqualTo("tolerance (-0.001) cannot be negative");
+      assertThat(e)
+          .hasMessageThat()
+          .isEqualTo(format("tolerance (%s) cannot be negative", -0.001f));
     }
   }
 
@@ -897,24 +992,25 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values not within 5.0E-6 of <[2.2, 3.3]>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values not within %s of <[%s, %s]>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 2.2f, 3.3f));
   }
 
   @Test
   @SuppressWarnings("deprecation") // testing deprecated method
   public void hasValuesNotWithinOfElementsIn_FailApproximatelyEquals() {
-    float roughly3point3 = nextAfter(3.3f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY);
     expectFailure
         .whenTesting()
         .that(array(2.2f, 3.3f))
         .hasValuesNotWithin(DEFAULT_TOLERANCE)
-        .ofElementsIn(Floats.asList(2.2f, roughly3point3));
+        .ofElementsIn(Floats.asList(2.2f, TOLERABLE_3POINT3));
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values not within 5.0E-6 of <[2.2, "
-                + roughly3point3
-                + "]>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values not within %s of <[%s, %s]>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 2.2f, TOLERABLE_3POINT3));
   }
 
   @Test
@@ -922,7 +1018,7 @@
   public void hasValuesNotWithinOfElementsIn_NotQuiteApproximatelyEquals() {
     assertThat(array(2.2f, 3.3f))
         .hasValuesNotWithin(DEFAULT_TOLERANCE)
-        .ofElementsIn(Floats.asList(2.2f, nextAfter(3.3f + DEFAULT_TOLERANCE, POSITIVE_INFINITY)));
+        .ofElementsIn(Floats.asList(2.2f, INTOLERABLE_3POINT3));
   }
 
   @Test
@@ -936,8 +1032,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, Infinity]> has values not within 5.0E-6 of"
-                + " <[2.2, Infinity]>");
+            format(
+                "Not true that <(float[]) [%s, Infinity]> has values not within %s of"
+                    + " <[%s, Infinity]>",
+                2.2f, DEFAULT_TOLERANCE, 2.2f));
   }
 
   @Test
@@ -951,8 +1049,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <(float[]) [2.2, 3.3]> has values not within 5.0E-6 of"
-                + " <[2.2, Infinity]>");
+            format(
+                "Not true that <(float[]) [%s, %s]> has values not within %s of"
+                    + " <[%s, Infinity]>",
+                2.2f, 3.3f, DEFAULT_TOLERANCE, 2.2f));
   }
 
   @Test
@@ -973,7 +1073,10 @@
         .ofElementsIn(Floats.asList(NaN));
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
-        .isEqualTo("Not true that <(float[]) [NaN]> has values not within 5.0E-6 of <[NaN]>");
+        .isEqualTo(
+            format(
+                "Not true that <(float[]) [NaN]> has values not within %s of <[NaN]>",
+                DEFAULT_TOLERANCE));
   }
 
   @Test
@@ -1011,40 +1114,36 @@
           .ofElementsIn(Floats.asList(3.3f, 2.2f));
       fail("Expected IllegalArgumentException to be thrown");
     } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessageThat().isEqualTo("tolerance (-0.001) cannot be negative");
+      assertThat(e)
+          .hasMessageThat()
+          .isEqualTo(format("tolerance (%s) cannot be negative", -0.001f));
     }
   }
 
   @Test
   public void usingTolerance_contains_success() {
-    assertThat(array(1.0f, nextAfter(2.0f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY), 3.0f))
-        .usingTolerance(DEFAULT_TOLERANCE)
-        .contains(2.0f);
+    assertThat(array(1.0f, TOLERABLE_TWO, 3.0f)).usingTolerance(DEFAULT_TOLERANCE).contains(2.0f);
   }
 
   @Test
   public void usingTolerance_contains_successWithExpectedLong() {
-    assertThat(array(1.0f, nextAfter(2.0f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY), 3.0f))
-        .usingTolerance(DEFAULT_TOLERANCE)
-        .contains(2L);
+    assertThat(array(1.0f, TOLERABLE_TWO, 3.0f)).usingTolerance(DEFAULT_TOLERANCE).contains(2L);
   }
 
   @Test
   public void usingTolerance_contains_failure() {
-    float justOverTwoPlusTolerance = nextAfter(2.0f + DEFAULT_TOLERANCE, POSITIVE_INFINITY);
     expectFailure
         .whenTesting()
-        .that(array(1.0f, justOverTwoPlusTolerance, 3.0f))
+        .that(array(1.0f, INTOLERABLE_TWO, 3.0f))
         .usingTolerance(DEFAULT_TOLERANCE)
         .contains(2.0f);
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, "
-                + justOverTwoPlusTolerance
-                + ", 3.0]> contains at least one element that is a finite number within "
-                + (double) DEFAULT_TOLERANCE
-                + " of <2.0>");
+            format(
+                "Not true that <[%s, %s, %s]> contains at least one element that is a finite "
+                    + "number within %s of <%s>",
+                1.0f, INTOLERABLE_TWO, 3.0f, (double) DEFAULT_TOLERANCE, 2.0f));
   }
 
   @Test
@@ -1057,10 +1156,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, Infinity, 3.0]> contains at least one element that is "
-                + "a finite number within "
-                + (double) DEFAULT_TOLERANCE
-                + " of <Infinity>");
+            format(
+                "Not true that <[%s, Infinity, %s]> contains at least one element that is "
+                    + "a finite number within %s of <Infinity>",
+                1.0f, 3.0f, (double) DEFAULT_TOLERANCE));
   }
 
   @Test
@@ -1073,10 +1172,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, NaN, 3.0]> contains at least one element that is "
-                + "a finite number within "
-                + (double) DEFAULT_TOLERANCE
-                + " of <NaN>");
+            format(
+                "Not true that <[%s, NaN, %s]> contains at least one element that is "
+                    + "a finite number within %s of <NaN>",
+                1.0f, 3.0f, (double) DEFAULT_TOLERANCE));
   }
 
   @Test
@@ -1109,9 +1208,7 @@
     // For the actual value we use the next value down, which is is 2^40 smaller (because the
     // resolution of floats with absolute values between 2^63 and 2^64 is 2^40). So we'll make the
     // assertion with a tolerance of 2^41.
-    assertThat(array(1.0f, nextAfter(Long.MIN_VALUE, NEGATIVE_INFINITY), 3.0f))
-        .usingTolerance(1L << 41)
-        .contains(Long.MIN_VALUE);
+    assertThat(array(1.0f, UNDER_LONG_MIN, 3.0f)).usingTolerance(1L << 41).contains(Long.MIN_VALUE);
     // Expected value is BigInteger
     assertThat(array(1.0f, 2.0f + 0.5f * DEFAULT_TOLERANCE, 3.0f))
         .usingTolerance(DEFAULT_TOLERANCE)
@@ -1145,36 +1242,38 @@
 
   @Test
   public void usingTolerance_containsAllOf_primitiveFloatArray_success() {
-    assertThat(array(1.0f, nextAfter(2.0f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY), 3.0f))
+    assertThat(array(1.0f, TOLERABLE_TWO, 3.0f))
         .usingTolerance(DEFAULT_TOLERANCE)
         .containsAllOf(array(2.0f, 1.0f));
   }
 
   @Test
   public void usingTolerance_containsAllOf_primitiveFloatArray_failure() {
-    float justOverTwoPlusTolerance = nextAfter(2.0f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY);
     expectFailure
         .whenTesting()
-        .that(array(1.0f, justOverTwoPlusTolerance, 3.0f))
+        .that(array(1.0f, TOLERABLE_TWO, 3.0f))
         .usingTolerance(DEFAULT_TOLERANCE)
         .containsAllOf(array(2.0f, 99.99f));
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, "
-                + justOverTwoPlusTolerance
-                + ", 3.0]> contains at least one element that is a finite number "
-                + "within "
-                + (double) DEFAULT_TOLERANCE
-                + " of each element of <[2.0, 99.99]>. It is missing an element that is a finite "
-                + "number within "
-                + (double) DEFAULT_TOLERANCE
-                + " of <99.99>");
+            format(
+                "Not true that <[%s, %s, %s]> contains at least one element that is a "
+                    + "finite number within %s of each element of <[%s, %s]>. "
+                    + "It is missing an element that is a finite number within %s of <%s>",
+                1.0f,
+                TOLERABLE_TWO,
+                3.0f,
+                (double) DEFAULT_TOLERANCE,
+                2.0f,
+                99.99f,
+                (double) DEFAULT_TOLERANCE,
+                99.99f));
   }
 
   @Test
   public void usingTolerance_containsAllOf_primitiveFloatArray_inOrder_success() {
-    assertThat(array(1.0f, nextAfter(2.0f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY), 3.0f))
+    assertThat(array(1.0f, TOLERABLE_TWO, 3.0f))
         .usingTolerance(DEFAULT_TOLERANCE)
         .containsAllOf(array(1.0f, 2.0f))
         .inOrder();
@@ -1182,77 +1281,71 @@
 
   @Test
   public void usingTolerance_containsAllOf_primitiveFloatArray_inOrder_failure() {
-    float justOverTwoPlusTolerance = nextAfter(2.0f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY);
     expectFailure
         .whenTesting()
-        .that(array(1.0f, justOverTwoPlusTolerance, 3.0f))
+        .that(array(1.0f, TOLERABLE_TWO, 3.0f))
         .usingTolerance(DEFAULT_TOLERANCE)
         .containsAllOf(array(2.0f, 1.0f))
         .inOrder();
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, "
-                + justOverTwoPlusTolerance
-                + ", 3.0]> contains, in order, at least one element that is a finite number "
-                + "within "
-                + (double) DEFAULT_TOLERANCE
-                + " of each element of <[2.0, 1.0]>");
+            format(
+                "Not true that <[%s, %s, %s]> contains, in order, at least one element that"
+                    + " is a finite number within %s of each element of <[%s, %s]>",
+                1.0f, TOLERABLE_TWO, 3.0f, (double) DEFAULT_TOLERANCE, 2.0f, 1.0f));
   }
 
   @Test
   public void usingTolerance_containsAnyOf_primitiveFloatArray_success() {
-    assertThat(array(1.0f, nextAfter(2.0f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY), 3.0f))
+    assertThat(array(1.0f, TOLERABLE_TWO, 3.0f))
         .usingTolerance(DEFAULT_TOLERANCE)
         .containsAnyOf(array(99.99f, 2.0f));
   }
 
   @Test
   public void usingTolerance_containsAnyOf_primitiveFloatArray_failure() {
-    float justOverTwoPlusTolerance = nextAfter(2.0f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY);
     expectFailure
         .whenTesting()
-        .that(array(1.0f, justOverTwoPlusTolerance, 3.0f))
+        .that(array(1.0f, TOLERABLE_TWO, 3.0f))
         .usingTolerance(DEFAULT_TOLERANCE)
         .containsAnyOf(array(99.99f, 999.999f));
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, "
-                + justOverTwoPlusTolerance
-                + ", 3.0]> contains at least one element that is a finite number within "
-                + (double) DEFAULT_TOLERANCE
-                + " of any element in <[99.99, 999.999]>");
+            format(
+                "Not true that <[%s, %s, %s]> contains at least one element that is "
+                    + "a finite number within %s of any element in <[%s, %s]>",
+                1.0f, TOLERABLE_TWO, 3.0f, (double) DEFAULT_TOLERANCE, 99.99f, 999.999f));
   }
 
   @Test
   public void usingTolerance_containsExactly_primitiveFloatArray_success() {
-    assertThat(array(1.0f, nextAfter(2.0f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY), 3.0f))
+    assertThat(array(1.0f, TOLERABLE_TWO, 3.0f))
         .usingTolerance(DEFAULT_TOLERANCE)
         .containsExactly(array(2.0f, 1.0f, 3.0f));
   }
 
   @Test
   public void usingTolerance_containsExactly_primitiveFloatArray_failure() {
-    float justOverTwoPlusTolerance = nextAfter(2.0f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY);
     expectFailure
         .whenTesting()
-        .that(array(1.0f, justOverTwoPlusTolerance, 3.0f))
+        .that(array(1.0f, TOLERABLE_TWO, 3.0f))
         .usingTolerance(DEFAULT_TOLERANCE)
         .containsExactly(array(2.0f, 1.0f));
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, "
-                + justOverTwoPlusTolerance
-                + ", 3.0]> contains exactly one element that is a finite number within "
-                + (double) DEFAULT_TOLERANCE
-                + " of each element of <[2.0, 1.0]>. It has unexpected elements <[3.0]>");
+            format(
+                "Not true that <[%s, %s, %s]> contains exactly one element that is a finite "
+                    + "number within %s of each element of <[%s, %s]>. "
+                    + "It has unexpected elements <[%s]>",
+                1.0f, TOLERABLE_TWO, 3.0f, (double) DEFAULT_TOLERANCE, 2.0f, 1.0f, 3.0f));
   }
 
   @Test
   public void usingTolerance_containsExactly_primitiveFloatArray_inOrder_success() {
-    assertThat(array(1.0f, nextAfter(2.0f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY), 3.0f))
+    assertThat(array(1.0f, TOLERABLE_TWO, 3.0f))
         .usingTolerance(DEFAULT_TOLERANCE)
         .containsExactly(array(1.0f, 2.0f, 3.0f))
         .inOrder();
@@ -1260,49 +1353,49 @@
 
   @Test
   public void usingTolerance_containsExactly_primitiveFloatArray_inOrder_failure() {
-    float justOverTwoPlusTolerance = nextAfter(2.0f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY);
     expectFailure
         .whenTesting()
-        .that(array(1.0f, justOverTwoPlusTolerance, 3.0f))
+        .that(array(1.0f, TOLERABLE_TWO, 3.0f))
         .usingTolerance(DEFAULT_TOLERANCE)
         .containsExactly(array(2.0f, 1.0f, 3.0f))
         .inOrder();
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, "
-                + justOverTwoPlusTolerance
-                + ", 3.0]> contains, in order, exactly one element that is a finite number "
-                + "within "
-                + (double) DEFAULT_TOLERANCE
-                + " of each element of <[2.0, 1.0, 3.0]>");
+            format(
+                "Not true that <[%s, %s, %s]> contains, in order, exactly one element that is a "
+                    + "finite number within %s of each element of <[%s, %s, %s]>",
+                1.0f, TOLERABLE_TWO, 3.0f, (double) DEFAULT_TOLERANCE, 2.0f, 1.0f, 3.0f));
   }
 
   @Test
   public void usingTolerance_containsNoneOf_primitiveFloatArray_success() {
-    assertThat(array(1.0f, nextAfter(2.0f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY), 3.0f))
+    assertThat(array(1.0f, TOLERABLE_TWO, 3.0f))
         .usingTolerance(DEFAULT_TOLERANCE)
         .containsNoneOf(array(99.99f, 999.999f));
   }
 
   @Test
   public void usingTolerance_containsNoneOf_primitiveFloatArray_failure() {
-    float justOverTwoPlusTolerance = nextAfter(2.0f + DEFAULT_TOLERANCE, NEGATIVE_INFINITY);
     expectFailure
         .whenTesting()
-        .that(array(1.0f, justOverTwoPlusTolerance, 3.0f))
+        .that(array(1.0f, TOLERABLE_TWO, 3.0f))
         .usingTolerance(DEFAULT_TOLERANCE)
         .containsNoneOf(array(99.99f, 2.0f));
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, "
-                + justOverTwoPlusTolerance
-                + ", 3.0]> contains no element that is a finite number within "
-                + (double) DEFAULT_TOLERANCE
-                + " of any element in <[99.99, 2.0]>. It contains <["
-                + justOverTwoPlusTolerance
-                + " which corresponds to 2.0]>");
+            format(
+                "Not true that <[%s, %s, %s]> contains no element that is a finite number within %s"
+                    + " of any element in <[%s, %s]>. It contains <[%s which corresponds to %s]>",
+                1.0f,
+                TOLERABLE_TWO,
+                3.0f,
+                (double) DEFAULT_TOLERANCE,
+                99.99f,
+                2.0f,
+                TOLERABLE_TWO,
+                2.0f));
   }
 
   @Test
@@ -1312,18 +1405,18 @@
 
   @Test
   public void usingExactEquality_contains_failure() {
-    float justOverTwo = nextAfter(2.0f, POSITIVE_INFINITY);
     expectFailure
         .whenTesting()
-        .that(array(1.0f, justOverTwo, 3.0f))
+        .that(array(1.0f, JUST_OVER_2POINT2, 3.0f))
         .usingExactEquality()
-        .contains(2.0f);
+        .contains(2.2f);
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, "
-                + justOverTwo
-                + ", 3.0]> contains at least one element that is exactly equal to <2.0>");
+            format(
+                "Not true that <[%s, %s, %s]> contains at least one element "
+                    + "that is exactly equal to <%s>",
+                1.0f, JUST_OVER_2POINT2, 3.0f, 2.2f));
   }
 
   @Test
@@ -1409,8 +1502,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, -0.0, 3.0]> contains at least one element that is "
-                + "exactly equal to <0.0>");
+            format(
+                "Not true that <[%s, -0.0, %s]> contains at least one element that is "
+                    + "exactly equal to <%s>",
+                1.0f, 3.0f, 0.0f));
   }
 
   @Test
@@ -1437,9 +1532,11 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, 2.0, 3.0]> contains at least one element that is exactly equal "
-                + "to each element of <[2.0, 99.99]>. It is missing an element that is exactly "
-                + "equal to <99.99>");
+            format(
+                "Not true that <[%s, %s, %s]> contains at least one element that is exactly equal "
+                    + "to each element of <[%s, %s]>. It is missing an element that is exactly "
+                    + "equal to <%s>",
+                1.0f, 2.0f, 3.0f, 2.0f, 99.99f, 99.99f));
   }
 
   @Test
@@ -1461,8 +1558,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, 2.0, 3.0]> contains, in order, at least one element that is "
-                + "exactly equal to each element of <[2.0, 1.0]>");
+            format(
+                "Not true that <[%s, %s, %s]> contains, in order, at least one element that is "
+                    + "exactly equal to each element of <[%s, %s]>",
+                1.0f, 2.0f, 3.0f, 2.0f, 1.0f));
   }
 
   @Test
@@ -1480,8 +1579,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, 2.0, 3.0]> contains at least one element that is exactly equal "
-                + "to any element in <[99.99, 999.999]>");
+            format(
+                "Not true that <[%s, %s, %s]> contains at least one element that is exactly equal "
+                    + "to any element in <[%s, %s]>",
+                1.0f, 2.0f, 3.0f, 99.99f, 999.999f));
   }
 
   @Test
@@ -1501,8 +1602,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, 2.0, 3.0]> contains exactly one element that is exactly equal "
-                + "to each element of <[2.0, 1.0]>. It has unexpected elements <[3.0]>");
+            format(
+                "Not true that <[%s, %s, %s]> contains exactly one element that is exactly equal "
+                    + "to each element of <[%s, %s]>. It has unexpected elements <[%s]>",
+                1.0f, 2.0f, 3.0f, 2.0f, 1.0f, 3.0f));
   }
 
   @Test
@@ -1524,8 +1627,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, 2.0, 3.0]> contains, in order, exactly one element that is "
-                + "exactly equal to each element of <[2.0, 1.0, 3.0]>");
+            format(
+                "Not true that <[%s, %s, %s]> contains, in order, exactly one element that is "
+                    + "exactly equal to each element of <[%s, %s, %s]>",
+                1.0f, 2.0f, 3.0f, 2.0f, 1.0f, 3.0f));
   }
 
   @Test
@@ -1545,8 +1650,10 @@
     assertThat(expectFailure.getFailure())
         .hasMessageThat()
         .isEqualTo(
-            "Not true that <[1.0, 2.0, 3.0]> contains no element that is exactly equal to any "
-                + "element in <[99.99, 2.0]>. It contains <[2.0 which corresponds to 2.0]>");
+            format(
+                "Not true that <[%s, %s, %s]> contains no element that is exactly equal to any "
+                    + "element in <[%s, %s]>. It contains <[%s which corresponds to %s]>",
+                1.0f, 2.0f, 3.0f, 99.99f, 2.0f, 2.0f, 2.0f));
   }
 
   private static float[] array(float... primitives) {