GitHub Coding Task
The Main file is MostActiveCookie.java
The Test file is MostActiveCookieTest.java
Clone repository
Install the latest version of Java.
You may need to set your JAVA_HOME.
cd CodingTask\QuantcastGithubProject\src\com\quantcast
javac -cp "commons-cli-1.5.0.jar;commons-cli-1.5.0-javadoc.jar;commons-cli-1.5.0-sources.jar;commons-cli-1.5.0-tests.jar;commons-cli-1.5.0-test-sources.jar" MostActiveCookie.java
java -cp "commons-cli-1.5.0.jar;commons-cli-1.5.0-javadoc.jar;commons-cli-1.5.0-sources.jar;commons-cli-1.5.0-tests.jar;commons-cli-1.5.0-test-sources.jar" MostActiveCookie.java cookieData.csv -d 2018-12-09
cd CodingTask/QuantcastGithubProject/src/com/quantcast
javac -cp commons-cli-1.5.0.jar:commons-cli-1.5.0-javadoc.jar:commons-cli-1.5.0-sources.jar:commons-cli-1.5.0-tests.jar:commons-cli-1.5.0-test-sources.jar MostActiveCookie.java
java -cp commons-cli-1.5.0.jar:commons-cli-1.5.0-javadoc.jar:commons-cli-1.5.0-sources.jar:commons-cli-1.5.0-tests.jar:commons-cli-1.5.0-test-sources.jar MostActiveCookie cookieData.csv -d 2018-12-09
java -cp commons-cli-1.5.0.jar:commons-cli-1.5.0-javadoc.jar:commons-cli-1.5.0-sources.jar:commons-cli-1.5.0-tests.jar:commons-cli-1.5.0-test-sources.jar JavaFilePath CSV file path -d Input date
Open the cloned Project - QuantcastGithubProject
Open Eclipse > Import Project QuantcastGithubProject
Right-click on MostActiveCookieTest.java
Run As > Junit Test
I have used apache.commons.cli library to use “-d” as parameter to enter date in command line.
The above command line adds the class path of external libraries , takes cookieData.csv as 1st argument and input date as “-d ” parameter.
Junit tests are added to MostActiveCookieTest.java
The program has been designed such that an exception will be thrown in the following cases:
-
If the input CSV file path passed in the argument cannot be located at specified location
-
If the input CSV file path is not added as argument in the command line.
-
If input date is not passed as “-d” parameter.
-
If the input date entered is not in the correct format i.e. yyyy-MM-dd .

