Ultra Geile Studenten Benutzer Oberfläche (UGSBO)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.4 KiB

  1. package com.ugsbo.complexnumcalc;
  2. import static org.hamcrest.MatcherAssert.assertThat;
  3. import static org.hamcrest.Matchers.*;
  4. import org.junit.Test;
  5. public class conjugationOfComplexNumbersTest {
  6. @Test
  7. public void TheConjugatedComplexNumberOfAComplexNumberWithOnlyARealPartShouldBeTheRealPart_ButItIsNot() {
  8. Double realPart = Double.valueOf(4);
  9. Double imaginaryPart = Double.valueOf(0);
  10. ComplexNumber complexNumber = new ComplexNumber(realPart, imaginaryPart);
  11. ComplexNumber expected = new ComplexNumber(realPart, imaginaryPart);
  12. ComplexNumber actual = complexNumber.conjugationOf();
  13. assertThat("The conjugated complex Number of a complex number with only a real part is the real part", expected, equalTo(actual));
  14. }
  15. @Test
  16. public void TheConjugatedComplexNumberOfAComplexNumberShouldBeTheComplexNumberWithSwapedSignImaginaryPart_ButItIsNot() {
  17. Double realPart = Double.valueOf(4);
  18. Double imaginaryPart = Double.valueOf(5);
  19. ComplexNumber complexNumber = new ComplexNumber(realPart, imaginaryPart);
  20. ComplexNumber expected = new ComplexNumber(realPart, -imaginaryPart);
  21. ComplexNumber actual = complexNumber.conjugationOf();
  22. assertThat("The conjugated complex number of a complex number is the complex number with swaped sign in the imaginary part", expected, equalTo(actual));
  23. }
  24. }