CompSci 307
Spring 2019
Software Design and Implementation

Test Driven Design with Enumerated Types

An Enumerated Type is a specialized class in Java that allows you to create a set of predefined constants. Common examples include compass directions (e.g., NORTH, SOUTH, EAST, and WEST) or the days of the week. A variable can only be equal to one of the predefined values and no other instances can be created dynamically, but it provides better security against errors that may occur if you simply used Strings or Integers to denote a fixed set of values.

Getting Started

For this lab exercise, it is suggested that you work together with one other person in the class:

Enumerated Types

Add a test to the HandTest class that creates a Hand that includes a Joker card and another example Hand, then compare the two hands and expect that the hand with a Joker has the higher value.

However, the Joker card does not technically have a Suit or Color. So to make this test pass, add NONE values to both the Color and Suit Enumerated Type classes. The NONE Suit should be created with a NONE Color and a "*" symbol.

Once you think you have this part working, use GIT to add and commit the changes you have made.

Test Driven Design

Complete last week's lab exercise with these given classes as a starting point.

As before, use the TDD process and verify you are doing so by committing each test first before the code that implements that test.

Submission

At the end of class, use Gitlab's Merge Request to submit your code to the original organization repository (note, there is no discussion file for this lab). Make sure your NetID is in the title of your Merge Request and in comments within the main class.