}
}
@Test
public final void testGetInverse() {
final Quaternion q = new Quaternion(1.5, 4, 2, -2.5);
final Quaternion inverseQ = q.getInverse();
Assert.assertEquals(1.5 / 28.5, inverseQ.getQ0(), 0);
Assert.assertEquals(-4.0 / 28.5, inverseQ.getQ1(), 0);
Assert.assertEquals(-2.0 / 28.5, inverseQ.getQ2(), 0);
Assert.assertEquals(2.5 / 28.5, inverseQ.getQ3(), 0);
final Quaternion product = Quaternion.multiply(inverseQ, q);
Assert.assertEquals(1, product.getQ0(), EPS);
Assert.assertEquals(0, product.getQ1(), EPS);
Assert.assertEquals(0, product.getQ2(), EPS);
Assert.assertEquals(0, product.getQ3(), EPS);
final Quaternion qNul = new Quaternion(0, 0, 0, 0);
try {
final Quaternion inverseQNul = qNul.getInverse();
Assert.fail("expecting ZeroException but got : " + inverseQNul);
} catch (ZeroException ex) {
// expected
}
}