COMP1721 Coursework 2

Using Gradle

Everything you need to do in this assignment, aside from editing code, is handled by the Gradle build system. You can run Gradle from the command line or use it from within the IntelliJ IDE if you prefer. If using IntelliJ, please use a recent version of the IDE on your own PC and run the Import Project wizard, specifying the project type as 'Gradle'.

You do not need to install Gradle yourself, as we've included a 'Gradle wrapper' that will download a compatible version of the tool, along with various library dependencies, if required. This will be very slow the first time that it runs!

On Linux and macOS, run the wrapper with ./gradlew. On Windows, it should be possible to run it with gradlew. The commands below assume the use of Linux or macOS.

Class Testing

You must implement classes Deck and PokerHand in the files Deck.java and PokerHand.java that have already been provided for you in src/main/java/comp1721/cwk2. As with Coursework 1, you need to start with stub implementations of these classes in order to compile and run the tests.

To run all the unit tests, recompiling code where necessary, do

./gradlew test

To run only the tests for the basic solution, do

./gradlew test --tests Basic

Substitute Full for Basic in the above command to run only the tests for the full solution.

Tests and their status (PASSED or FAILED) are listed in the terminal. A test report is also generated in HTML, containing detailed information about the tests and any failures that have occurred. You can access this by pointing your browser at build/reports/tests/test/index.html. We suggest you keep this page open in a browser tab, refreshing it as necessary, so that you always have full information available on test results.

Note that Gradle won't normally rerun tests if they have all passed, unless you've changed something in your code. You can force it to recompile everything and rerun the tests using

./gradlew test --rerun-tasks

Style Checking

To check coding style for the classes, do

./gradlew style

If there are any style violations, you'll see a count reported in the terminal window. A full report on the violations can be viewed by pointing your browser at build/reports/checkstyle/main.html. Treat this report as a rough guide only. Warnings will not necessarily lead to the deduction of style marks. Also, note that style checking is not exhaustive and we may still penalise you on style grounds even if no violations are reported here.

As with unit tests, Gradle normally won't rerun the style check unless you change something in your code.

You can check coding style and run tests in one go with

./gradlew check

Generating Documentation

To generate HTML documentation from doc comments in the core classes, do

./gradlew javadoc

Then view the documentation by pointing a web browser at build/docs/javadoc/index.html.

The PokerStats Application

This is provided for you, as an additional way of checking that your classes are implemented correctly. You can run the application like this:

./gradlew run

The log file created by this program can be found in the build directory.

Cleaning Up

To remove all files generated by the build process, use

./gradlew clean

Submitting

To generate a Zip archive containing all of the code that needs to be submitted, do

./gradlew submission