@Test
public void testMultiply() {

  final Quaternion quat1 = new Quaternion(0.5, 1, 2, 3);
  final Quaternion quat2 = new Quaternion();
  assertEquals(new Quaternion(1, 2, 4, 6), quat1.multiply(2, null));
  assertEquals(new Quaternion(2, 4, 8, 12), quat1.multiply(4, quat2));
  assertEquals(new Quaternion(1, 2, 4, 6), quat1.multiplyLocal(2));
  quat1.fromAngleNormalAxis(MathUtils.QUARTER_PI, Vector3.UNIT_Y);
  quat1.multiply(quat1, quat2);
  final ReadOnlyVector3 vec = Vector3.UNIT_Z;
  assertTrue(Math.abs(Vector3.UNIT_X.distance(quat2.apply(vec, null))) <= Quaternion.ALLOWED_DEVIANCE);
  quat1.multiplyLocal(quat1.getX(), quat1.getY(), quat1.getZ(), quat1.getW());
  assertTrue(Math.abs(Vector3.UNIT_X.distance(quat1.apply(vec, null))) <= Quaternion.ALLOWED_DEVIANCE);
  quat2.fromAngleNormalAxis(MathUtils.HALF_PI, Vector3.UNIT_Y);
  quat1.multiplyLocal(quat2);
  assertTrue(Math.abs(Vector3.NEG_UNIT_Z.distance(quat1.apply(vec, null))) <= Quaternion.ALLOWED_DEVIANCE);
  quat1.multiplyLocal(new Matrix3().applyRotationY(MathUtils.HALF_PI));
  assertTrue(Math.abs(Vector3.NEG_UNIT_X.distance(quat1.apply(vec, null))) <= Quaternion.ALLOWED_DEVIANCE);
}