Location implements ReadableFloatVector { public static Location of(float latitude, float longitude) { return new Location(latitude, longitude); } private  Location(float latitude, float longitude); static Location of(float latitude, float longitude); static Location of(GeoLocation geoLocation); static Location of(float[] array); float getLatitude(); float getLongitude(); @Override String toString(); @Override int getElementCount(); @Override float getElement(int num); @Override boolean equals(Object o); @Override int hashCode();  }
@Test @DisplayName("Invalid Float Array") public void testInvalidFloatArray() { List<float[]> invalidArrays = ImmutableList .of(new float[] {}, new float[]{ 0f }, new float[]{ 0f, 1f, 2f }); for (float[] array : invalidArrays) { assertThrows(IllegalArgumentException.class, () -> Location.of(array)); } }
@Test @DisplayName("NaN Values") public void testNanValues() { assertThrows(IllegalArgumentException.class, () -> Location.of(Float.NaN, 0f)); assertThrows(IllegalArgumentException.class, () -> Location.of(0f, Float.NaN)); }