Skip to content

Commit

Permalink
Migrate to AssertJ (#136)
Browse files Browse the repository at this point in the history
* Migrate to AssertJ

* Migrate to AssertJ
  • Loading branch information
jodastephen authored Aug 18, 2024
1 parent 983b382 commit 0ae24d5
Show file tree
Hide file tree
Showing 15 changed files with 2,297 additions and 2,668 deletions.
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,12 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<!-- ==================================================================== -->
Expand Down Expand Up @@ -785,6 +791,7 @@
<!-- ==================================================================== -->
<properties>
<!-- Dependencies -->
<assertj.version>3.26.3</assertj.version>
<joda-convert.version>2.2.3</joda-convert.version>
<junit.version>5.11.0</junit.version>

Expand Down
1,479 changes: 677 additions & 802 deletions src/test/java/org/joda/money/TestBigMoney.java

Large diffs are not rendered by default.

35 changes: 17 additions & 18 deletions src/test/java/org/joda/money/TestCurrencyMismatchException.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
*/
package org.joda.money;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.Test;

Expand All @@ -34,37 +33,37 @@ class TestCurrencyMismatchException {
@Test
void test_new_GBPEUR() {
CurrencyMismatchException test = new CurrencyMismatchException(GBP, EUR);
assertEquals("Currencies differ: GBP/EUR", test.getMessage());
assertNull(test.getCause());
assertEquals(GBP, test.getFirstCurrency());
assertEquals(EUR, test.getSecondCurrency());
assertThat(test.getMessage()).isEqualTo("Currencies differ: GBP/EUR");
assertThat(test.getCause()).isNull();
assertThat(test.getFirstCurrency()).isEqualTo(GBP);
assertThat(test.getSecondCurrency()).isEqualTo(EUR);
}

@Test
void test_new_nullEUR() {
CurrencyMismatchException test = new CurrencyMismatchException(null, EUR);
assertEquals("Currencies differ: null/EUR", test.getMessage());
assertNull(test.getCause());
assertNull(test.getFirstCurrency());
assertEquals(EUR, test.getSecondCurrency());
assertThat(test.getMessage()).isEqualTo("Currencies differ: null/EUR");
assertThat(test.getCause()).isNull();
assertThat(test.getFirstCurrency()).isNull();
assertThat(test.getSecondCurrency()).isEqualTo(EUR);
}

@Test
void test_new_GBPnull() {
CurrencyMismatchException test = new CurrencyMismatchException(GBP, null);
assertEquals("Currencies differ: GBP/null", test.getMessage());
assertNull(test.getCause());
assertEquals(GBP, test.getFirstCurrency());
assertNull(test.getSecondCurrency());
assertThat(test.getMessage()).isEqualTo("Currencies differ: GBP/null");
assertThat(test.getCause()).isNull();
assertThat(test.getFirstCurrency()).isEqualTo(GBP);
assertThat(test.getSecondCurrency()).isNull();
}

@Test
void test_new_nullnull() {
CurrencyMismatchException test = new CurrencyMismatchException(null, null);
assertEquals("Currencies differ: null/null", test.getMessage());
assertNull(test.getCause());
assertNull(test.getFirstCurrency());
assertNull(test.getSecondCurrency());
assertThat(test.getMessage()).isEqualTo("Currencies differ: null/null");
assertThat(test.getCause()).isNull();
assertThat(test.getFirstCurrency()).isNull();
assertThat(test.getSecondCurrency()).isNull();
}

}
Loading

0 comments on commit 0ae24d5

Please sign in to comment.