Minor updates - Gradle to 4.6.0, updated :common/test

This commit is contained in:
anthony.cicchetti 2018-02-28 13:48:00 -05:00
parent 7fa804ca55
commit 7593182a14
10 changed files with 99 additions and 86 deletions

5
.idea/gradle.xml generated
View file

@ -3,8 +3,10 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="distributionType" value="WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:/Gradle/gradle-4.0.1" />
<option name="gradleJvm" value="Java 1.8u162" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
@ -14,6 +16,7 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useAutoImport" value="true" />
</GradleProjectSettings>
</option>
</component>

2
.idea/misc.xml generated
View file

@ -24,7 +24,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="Java 1.8u162" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

4
.idea/modules.xml generated
View file

@ -3,8 +3,12 @@
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/FinanceTracker.iml" filepath="$PROJECT_DIR$/FinanceTracker.iml" />
<module fileurl="file://$PROJECT_DIR$/FinanceTracker.iml" filepath="$PROJECT_DIR$/FinanceTracker.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/common/common.iml" filepath="$PROJECT_DIR$/common/common.iml" />
<module fileurl="file://$PROJECT_DIR$/common/common.iml" filepath="$PROJECT_DIR$/common/common.iml" />
<module fileurl="file://$PROJECT_DIR$/server/server.iml" filepath="$PROJECT_DIR$/server/server.iml" />
<module fileurl="file://$PROJECT_DIR$/server/server.iml" filepath="$PROJECT_DIR$/server/server.iml" />
</modules>
</component>

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

View file

@ -29,7 +29,7 @@ android {
}
dependencies {
compile project(':common')
implementation project(':common')
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'

View file

@ -33,6 +33,14 @@ allprojects {
]
}
//subprojects.findAll { !it.name.contains("app")}.each { p ->
// configure(p) {
// test {
// useJUnitPlatform()
// }
// }
//}
task clean(type: Delete) {
delete rootProject.buildDir
}

View file

@ -9,6 +9,10 @@ data class Money(@JsonValue private val cents: Int) {
return Money(this.cents - other.cents)
}
override fun toString(): String {
return cents.toString()
}
companion object {
fun fromDollarsAndCents(dollars: Int, cents: Int): Money {
require((cents <= 99) and (cents >= 0))

View file

@ -87,119 +87,119 @@ class MoneyTest {
@Test
fun `Positive Dollars`() {
val expectedResult = "$5.45"
val expectedResult = "545"
val actualResult = Money(545).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}
@Test
fun `Zero Dollars`() {
val expectedResult = "$0.50"
val expectedResult = "50"
val actualResult = Money(50).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}
@Test
fun `Negative Dollars`() {
val expectedResult = "-$5.66"
val expectedResult = "-566"
val actualResult = Money(-566).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}
@Test
fun `Add Positive and Positive Dollars`() {
val expectedResult = "$62.94"
val expectedResult = "6294"
val actualResult = (Money(4265) + Money(2029)).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}
@Test
fun `Add Positive Dollars and Negative Dollars with Positive Result`() {
val expectedResult = "$1.32"
val expectedResult = "132"
val actualResult = (Money(465) + Money(-333)).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}
@Test
fun `Add Positive Dollars and Negative Dollars with Negative Result`() {
val expectedResult = "-$5.27"
val expectedResult = "-527"
val actualResult = (Money(100) + Money(-627)).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}
@Test
fun `Add Negative Dollars and Positive Dollars with Positive Result`() {
val expectedResult = "$1.32"
val expectedResult = "132"
val actualResult = (Money(-333) + Money(465)).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}
@Test
fun `Add Negative Dollars and Positive Dollars with Negative Result`() {
val expectedResult = "-$5.73"
val expectedResult = "-573"
val actualResult = (Money(-627) + Money(54)).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}
@Test
fun `Add Negative Dollars and Negative Dollars with Negative Result`() {
val expectedResult = "-$15.42"
val expectedResult = "-1542"
val actualResult = (Money(-983) + Money(-559)).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}
@Test
fun `Subtract Positive Dollars and Positive Dollars with Positive Result`() {
val expectedResult = "$52.67"
val expectedResult = "5267"
val actualResult = (Money(10054) - Money(4787)).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}
@Test
fun `Subtract Positive Dollars and Positive Dollars with Negative Result`() {
val expectedResult = "-$4.16"
val expectedResult = "-416"
val actualResult = (Money(147) - Money(563)).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}
@Test
fun `Subtract Negative Dollars and Negative Dollars with Positive Result`() {
val expectedResult = "$7.89"
val expectedResult = "789"
val actualResult = (Money(-563) - Money(-1352)).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}
@Test
fun `Subtract Negative Dollars and Negative Dollars with Negative Result`() {
val expectedResult = "-$9.64"
val expectedResult = "-964"
val actualResult = (Money(-1563) - Money(-599)).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}
@Test
fun `Subtract Positive Dollars and Negative Dollars with Positive Result`() {
val expectedResult = "$176.84"
val expectedResult = "17684"
val actualResult = (Money(12354) - Money(-5330)).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}
@Test
fun `Subtract Negative Dollars and Positive Dollars with Negative Result`() {
val expectedResult = "-$5.68"
val expectedResult = "-568"
val actualResult = (Money(-432) - Money(136)).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}
@Test
fun `From Positive Dollars and Cents`() {
val expectedResult = "$5.87"
val expectedResult = "587"
val actualResult = Money.fromDollarsAndCents(5, 87).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}
@Test
fun `From Negative Dollars And Cents`() {
val expectedResult = "-$18.73"
val expectedResult = "-1873"
val actualResult = Money.fromDollarsAndCents(-18, 73).toString()
assertEquals(expectedResult, actualResult, "$expectedResult is not equal to $actualResult")
}

100
gradlew vendored
View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
##############################################################################
##
@ -6,42 +6,6 @@
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
@ -60,6 +24,46 @@ cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@ -85,7 +89,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@ -150,11 +154,19 @@ if $cygwin ; then
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

14
gradlew.bat vendored
View file

@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@ -46,10 +46,9 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line