From 441fe78e4178fa62e189fa26c0fa9c0de2927b2f Mon Sep 17 00:00:00 2001 From: Viktor Kolomeyko Date: Mon, 6 Aug 2018 11:59:30 +0100 Subject: [PATCH] CORDA-1568: Change Java source files encoding for all the projects. (#3707) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * CORDA-1568: Change Java source files encoding for all the projects. See: https://ci-master.corda.r3cev.com/viewLog.html?buildId=103073&tab=buildResultsDiv&buildTypeId=Corda_BuildWindowsTest ``` InteractiveShellJavaTest.flowStartWithComplexTypes show details No applicable constructor for flow. Problems were: [party: Party]: missing parameter party [pair: Pair]: missing parameter pair [Amount]: Could not parse as a command: Did not recognise the currency in £10 or could not parse ``` --- build.gradle | 1 + .../corda/core/contracts/AmountParsingTest.java | 15 +++++++++++++++ .../net/corda/core/contracts/AmountTests.kt | 6 ++++++ 3 files changed, 22 insertions(+) create mode 100644 core/src/test/java/net/corda/core/contracts/AmountParsingTest.java diff --git a/build.gradle b/build.gradle index dfb4c7f52b..76fef2e630 100644 --- a/build.gradle +++ b/build.gradle @@ -160,6 +160,7 @@ allprojects { tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-Xlint:-options" << "-parameters" + options.encoding = 'UTF-8' } tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { diff --git a/core/src/test/java/net/corda/core/contracts/AmountParsingTest.java b/core/src/test/java/net/corda/core/contracts/AmountParsingTest.java new file mode 100644 index 0000000000..1b23374ce2 --- /dev/null +++ b/core/src/test/java/net/corda/core/contracts/AmountParsingTest.java @@ -0,0 +1,15 @@ +package net.corda.core.contracts; + +import org.junit.Test; + +import static net.corda.finance.Currencies.POUNDS; +import static org.junit.Assert.assertEquals; + +public class AmountParsingTest { + + @Test + public void testGbpParse() { + assertEquals(POUNDS(10), Amount.parseCurrency("10 GBP")); + assertEquals(POUNDS(11), Amount.parseCurrency("£11")); + } +} diff --git a/core/src/test/kotlin/net/corda/core/contracts/AmountTests.kt b/core/src/test/kotlin/net/corda/core/contracts/AmountTests.kt index cd0053f969..f35931bb9f 100644 --- a/core/src/test/kotlin/net/corda/core/contracts/AmountTests.kt +++ b/core/src/test/kotlin/net/corda/core/contracts/AmountTests.kt @@ -162,4 +162,10 @@ class AmountTests { assertEquals(originalTotals[Pair(partyA, GBP)], newTotals3[Pair(partyA, GBP)]) assertEquals(originalTotals[Pair(partyB, GBP)], newTotals3[Pair(partyB, GBP)]) } + + @Test + fun testGbpParse() { + assertEquals(POUNDS(10), Amount.parseCurrency("10 GBP")) + assertEquals(POUNDS(11), Amount.parseCurrency("£11")) + } } \ No newline at end of file