mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-05-20 15:30:36 -04:00
fix junit test failures for subprojects
Co-authored-by: woodser <woodser@protonmail.com>
This commit is contained in:
parent
4ca5974493
commit
3b89212c6f
9 changed files with 37 additions and 53 deletions
|
@ -28,30 +28,23 @@ public class PriceTest {
|
|||
|
||||
@Test
|
||||
public void testParse() {
|
||||
Price result = parse("USD", "0.1");
|
||||
assertEquals(
|
||||
"0.10 XMR/USD",
|
||||
result.toFriendlyString(),
|
||||
parse("USD", "0.1").toFriendlyString(),
|
||||
"Fiat value should be formatted with two decimals."
|
||||
);
|
||||
|
||||
result = parse("EUR", "0.1234");
|
||||
assertEquals(
|
||||
"0.1234 XMR/EUR",
|
||||
result.toFriendlyString(),
|
||||
parse("EUR", "0.1234").toFriendlyString(),
|
||||
"Fiat value should be given two decimals"
|
||||
);
|
||||
|
||||
try {
|
||||
parse("EUR", "0.12345");
|
||||
fail("Expected IllegalArgumentException to be thrown when too many decimals are used.");
|
||||
} catch (IllegalArgumentException iae) {
|
||||
assertEquals(
|
||||
"java.lang.ArithmeticException: Rounding necessary",
|
||||
iae.getMessage(),
|
||||
"Unexpected exception message."
|
||||
);
|
||||
}
|
||||
assertEquals(
|
||||
"0.1235 XMR/EUR",
|
||||
parse("EUR", "0.12345").toFriendlyString(),
|
||||
"Too many decimals of fiat value should get rounded up properly."
|
||||
);
|
||||
|
||||
assertEquals(
|
||||
-100000000L,
|
||||
|
@ -96,17 +89,15 @@ public class PriceTest {
|
|||
}
|
||||
@Test
|
||||
public void testValueOf() {
|
||||
Price result = valueOf("USD", 1);
|
||||
assertEquals(
|
||||
"0.0001 XMR/USD",
|
||||
result.toFriendlyString(),
|
||||
valueOf("USD", 10000).toFriendlyString(),
|
||||
"Fiat value should have four decimals."
|
||||
);
|
||||
|
||||
result = valueOf("EUR", 1234);
|
||||
assertEquals(
|
||||
"0.1234 XMR/EUR",
|
||||
result.toFriendlyString(),
|
||||
valueOf("EUR", 12340000).toFriendlyString(),
|
||||
"Fiat value should be given two decimals"
|
||||
);
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import haveno.network.p2p.P2PService;
|
|||
import haveno.network.p2p.peers.PeerManager;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.nio.file.Files;
|
||||
|
@ -50,6 +51,7 @@ public class OpenOfferManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO: re-enable when editing offers supported
|
||||
public void testStartEditOfferForActiveOffer() {
|
||||
P2PService p2PService = mock(P2PService.class);
|
||||
OfferBookService offerBookService = mock(OfferBookService.class);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue