BAEL 767 - Introduction to Apache Commons Math (update) (#1670)

* BAEL 767 - Introduction to apache commons math

* BAEL 767 - Moving examples to test classes

* BAEL 767 - Renaming tests with BDD convention
This commit is contained in:
Alexandre Lombard
2017-04-18 09:58:26 +02:00
committed by maibin
parent 7d6bf29092
commit 1aff8ca17d
9 changed files with 224 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
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);
}
}