@Test
public void testNormalize() {

  final Vector2 vec1 = new Vector2(2, 1);
  assertTrue(vec1.length() == Math.sqrt(5));
  final Vector2 vec2 = vec1.normalize(null);
  final double invLength = MathUtils.inverseSqrt(2 * 2 + 1 * 1);
  assertEquals(new Vector2(2 * invLength, 1 * invLength), vec2);
  vec1.normalizeLocal();
  assertEquals(new Vector2(2 * invLength, 1 * invLength), vec1);
  vec1.zero();
  vec1.normalize(vec2);
  assertEquals(vec1, vec2);
  // ensure no exception thrown
  vec1.normalizeLocal();
  vec1.normalize(null);
}