diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..00a51aff5e5a83d6313f3bd15fadc601a205b66f --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +# +# https://help.github.com/articles/dealing-with-line-endings/ +# +# These are explicitly windows files and should use crlf +*.bat text eol=crlf + diff --git a/.project b/.project index c5e47582393b2f5f43105ca777bf97185e66eeb0..dd9332e8fc5ba24701858e6591eea445bce4ae2e 100644 --- a/.project +++ b/.project @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <projectDescription> - <name>dormitory</name> + <name>campus</name> <comment>Project dormitory created by Buildship.</comment> <projects> </projects> diff --git a/build.gradle b/build.gradle index acb2a71a8fd39b003ed0d6b71c7f7aea15c47334..c15c947d0ffc5382a96dcb912b4a3cd05633ff2a 100644 --- a/build.gradle +++ b/build.gradle @@ -3,14 +3,14 @@ * * This generated file contains a sample Java project to get you started. * For more details take a look at the Java Quickstart chapter in the Gradle - * User Manual available at https://docs.gradle.org/5.6.1/userguide/tutorial_java_projects.html + * User Manual available at https://docs.gradle.org/6.3/userguide/tutorial_java_projects.html */ plugins { // Apply the java plugin to add support for Java id 'java' - // Apply the application plugin to add support for building a CLI application + // Apply the application plugin to add support for building a CLI application. id 'application' } @@ -22,17 +22,17 @@ repositories { dependencies { // This dependency is used by the application. - implementation 'com.google.guava:guava:28.0-jre' + implementation 'com.google.guava:guava:28.2-jre' // Use JUnit Jupiter API for testing. - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0' // Use JUnit Jupiter Engine for testing. - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.2' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0' } application { - // Define the main class for the application + // Define the main class for the application. mainClassName = 'io.fp.dormitory.App' } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf016b3885f6930543d57b744ea8c220a1a..490fda8577df6c95960ba7077c43220e5bb2c0d9 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradlew b/gradlew index 83f2acfdc319a24e8766cca78f32474ad7a22dd6..2fe81a7d95e4f9ad2c9b2a046707d36ceb3980b3 100644 --- a/gradlew +++ b/gradlew @@ -154,19 +154,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -175,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # 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" "$@" diff --git a/gradlew.bat b/gradlew.bat index 9618d8d9607cd91a0efb866bcac4810064ba6fac..62bd9b9ccefea2b65ae41e5d9a545e2021b90a1d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @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="-Xmx64m" "-Xms64m" diff --git a/settings.gradle b/settings.gradle index c917dbf00d021a0606422713f326b297d1fb0972..43621cc760e4afdf4cb9308dd5ac963f116b471d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,7 +4,7 @@ * The settings file is used to specify which projects to include in your build. * * Detailed information about configuring a multi-project build in Gradle can be found - * in the user manual at https://docs.gradle.org/5.6.1/userguide/multi_project_builds.html + * in the user manual at https://docs.gradle.org/6.3/userguide/multi_project_builds.html */ -rootProject.name = 'dormitory' +rootProject.name = 'campus' diff --git a/src/main/java/io/fp/dormitory/App.java b/src/main/java/io/fp/dormitory/App.java index ff121996ad2a5f77ab3cca68249a9ee1bcff254c..840d90dd1518a5efeb8271942e3caf8e6d37befd 100644 --- a/src/main/java/io/fp/dormitory/App.java +++ b/src/main/java/io/fp/dormitory/App.java @@ -28,6 +28,7 @@ public class App { flat2.addStudent(student5); flat2.addStudent(student6); + System.out.println(dormi.numberOfStudents()); } } diff --git a/src/test/java/io/fp/dormitory/DormitoryTest.java b/src/test/java/io/fp/dormitory/DormitoryTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c6bb0c7b0160ff8fcd6140e238a76675cb00d4dc --- /dev/null +++ b/src/test/java/io/fp/dormitory/DormitoryTest.java @@ -0,0 +1,40 @@ +package io.fp.dormitory; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.ArrayList; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +/** + * DormitoryTest + */ +public class DormitoryTest { + + Dormitory dormi; + SharedFlat flat1; + + @BeforeEach + void setUp(){ + + flat1 = new SharedFlat(2); + + ArrayList<SharedFlat> flats = new ArrayList<>(); + + flats.add(flat1); + + dormi = new Dormitory(flats); + } + + @Test + void testAmountStudents(){ + + Student s1 = new Student("Mike", "MKIB"); + Student s2 = new Student("Anka", "WIB"); + flat1.addStudent(s1); + flat1.addStudent(s2); + + assertEquals(2, dormi.numberOfStudents()); + } +} \ No newline at end of file