* BAEL 767 - Introduction to apache commons math * BAEL 767 - Moving examples to test classes * BAEL 767 - Renaming tests with BDD convention
21 lines
523 B
Java
21 lines
523 B
Java
package com.baeldung.commons.math;
|
|
|
|
import org.apache.commons.math3.complex.Complex;
|
|
import org.junit.Assert;
|
|
import org.junit.Test;
|
|
|
|
public class ComplexTests {
|
|
|
|
@Test
|
|
public void whenComplexPow_thenCorrect() {
|
|
Complex first = new Complex(1.0, 3.0);
|
|
Complex second = new Complex(2.0, 5.0);
|
|
|
|
Complex power = first.pow(second);
|
|
|
|
Assert.assertEquals(-0.007563724861696302, power.getReal(), 1e-7);
|
|
Assert.assertEquals(0.01786136835085382, power.getImaginary(), 1e-7);
|
|
}
|
|
|
|
}
|