Compare commits

...

2 commits

Author SHA1 Message Date
5a3b1d3f19 Changed decimal formatting 2023-10-13 12:37:55 -07:00
b562b674a7 Updated dependencies 2023-10-13 12:37:20 -07:00
5 changed files with 16 additions and 16 deletions

View file

@ -5,14 +5,14 @@ import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
plugins {
id 'application'
id 'com.github.ben-manes.versions' version '0.48.0'
id 'com.github.ben-manes.versions' version '0.49.0'
id 'idea'
id 'io.gitlab.arturbosch.detekt' version '1.23.1'
id 'java'
id 'net.thauvin.erik.gradle.semver' version '1.0.4'
id 'org.jetbrains.kotlin.jvm' version '1.9.10'
id 'org.jetbrains.kotlin.kapt' version '1.9.10'
id 'org.jetbrains.kotlinx.kover' version '0.7.3'
id 'org.jetbrains.kotlinx.kover' version '0.7.4'
id 'org.sonarqube' version '4.4.1.3373'
id 'pmd'
}
@ -57,11 +57,11 @@ dependencies {
implementation 'org.apache.commons:commons-lang3:3.13.0'
implementation 'org.apache.commons:commons-text:1.10.0'
implementation 'commons-codec:commons-codec:1.16.0'
implementation 'commons-net:commons-net:3.9.0'
implementation 'commons-net:commons-net:3.10.0'
// Google
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.google.guava:guava:32.1.2-jre'
implementation 'com.google.guava:guava:32.1.3-jre'
// Kotlin
implementation platform('org.jetbrains.kotlin:kotlin-bom')

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

14
gradlew vendored
View file

@ -145,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \

View file

@ -133,7 +133,7 @@ class CurrencyConverter : AbstractModule() {
private val SYMBOLS: TreeMap<String, String> = TreeMap()
// Decimal format
private val DECIMAL_FORMAT = DecimalFormat("0.00")
private val DECIMAL_FORMAT = DecimalFormat("0.00#")
/**
* Converts from a currency to another.

View file

@ -64,15 +64,15 @@ class CurrencyConverterTest: LocalProperties() {
assertThat(
convertCurrency(apiKey,"100 USD to EUR").msg,
"convertCurrency(100 USD to EUR)"
).matches("100 United States Dollar = \\d{2,3}\\.\\d+ Euro".toRegex())
).matches("100 United States Dollar = \\d{2,3}\\.\\d{2,3} Euro".toRegex())
assertThat(
convertCurrency(apiKey,"1 USD to GBP").msg,
"convertCurrency(1 USD to BGP)"
).matches("1 United States Dollar = 0\\.\\d+ Pound Sterling".toRegex())
).matches("1 United States Dollar = 0\\.\\d{2,3} Pound Sterling".toRegex())
assertThat(
convertCurrency(apiKey,"100,000.00 CAD to USD").msg,
"convertCurrency(100,000.00 GBP to USD)"
).matches("100,000.00 Canadian Dollar = \\d+\\.\\d+ United States Dollar".toRegex())
).matches("100,000.00 Canadian Dollar = \\d+\\.\\d{2,3} United States Dollar".toRegex())
assertThat(convertCurrency(apiKey,"100 USD to USD"), "convertCurrency(100 USD to USD)").all {
prop(Message::msg).contains("You're kidding, right?")
isInstanceOf(PublicMessage::class.java)