Starting from:

$30

CS1632-Assignment 2 Solved

For this assignment, your will write code and unit tests for an
authorized reproduction of Coffee Maker Quest.  

Requirements for this program are in the requirements.txt file in this
directory.  In case of ambiguity, please see the original program
coffeemaker.jar as an example of what to display and how the system should
work.

Some of the work has already been done for you.  Classes such as
CoffeeMakerQuest.java, Config.java, Game.java, Player.java, Room.java, and
TestRunner.java are already complete.  You need only modify
CoffeeMakerQuestImpl.java and CoffeeMakerQuestTest.java.  As in the
exercise, the places where you need to modify code are marked by the // TODO
comments.  DO NOT TOUCH the already complete classes as they will be used AS
IS during grading.  Here is a brief rundown of the classes:

* CoffeeMakerQuest.java - the interface for the CoffeeMakerQuest game engine
* Config.java - allows configuration of bug injection into various classes
* Game.java - contains the main method; generates rooms and runs the game using the CoffeeMakerQuest engine
* Player.java - player object with inventory information
* Room.java - room object with furnishings and items
* TestRunner.java - the runner for the JUnit test class CoffeeMakerQuestTest
* CoffeeMakerQuestImpl.java - an implementation of CoffeeMakerQuest (_modify_)
* CoffeeMakerQuestTest.java - JUnit test class CoffeeMakerQuest (_modify_)


1. To run the game you need to invoke the Game class.  For Windows:
    ```
    runGame.bat
    ```
    For Mac or Linux, try doing:
    ```
    bash runGame.sh
    ```
    When you run it without any modification, you will suffer an exception and crash.  That is of course because you have not completed implementing CoffeeMakerQuestImpl.java!

1. To run the JUnit tests on CoffeeMakerQuestImpl, for Windows:
    ```
    runTest.bat
    ```
    For Mac or Linux, try doing:
    ```
    bash runTest.sh
    ```
    When you run it without any modification, you will get "ALL TESTS PASSED".  But don't get delirious.  That is because all your tests are currently empty.

1. To run the JUnit tests on CoffeeMakerQuestBuggy (included in the form of
   the coffeemaker-buggy.jar file), for Windows:
    ```
    runTestBuggy.bat
    ```
    For Mac or Linux, try doing:
    ```
    bash runTestBuggy.sh
    ```

## Development Methodology

Like Exercise 2, we will try to apply the Test Driven Development (TDD) model
here.  Try writing the test case(s) FIRST before writing the code for a
feature.  This way, you will always have 100% test coverage for the code you
have written and are writing.  Hence, if you break any part of it in the course
of adding a feature or refactoring your code, you will know immediately.

## Expected Outcome

You should see the following output when running runTest.bat (or runTest.sh):
```
ALL TESTS PASSED
```

And after running runTestBuggy.bat (or runTestBuggy.sh), you should get output that looks like [runTestBuggy.output.txt](runTestBuggy.output.txt).  If you do, this tells you that you have written your JUnit tests well so that they are able to find the bugs in CoffeeMakerQuestBuggy.  Note that I've commented out the following line at TestRunner.java:30 to make the output less verbose:
```
System.out.println(f.getTrace());
```
The above will print a full Java stack trace for every failure.  It is useful when a test fails due to a crash in your program and you want to locate exactly in which source code line the Java exception was thrown.  The defects in this CoffeeMakerQuestBuggy does not involve crashes due to exceptions so I've temporarily commented it out for brevity.

More products