Activity: JUnit - Hangman

(no submission)

Purpose:

Require: Java 8 (or higher), JUnit (you are recommended to use the latest version, JUnit 5).

Additional resources: You may find class discussions on RIPR model, test automation, and characteristics of good tests helpful when designing and automating your tests.


Instruction

You may work alone or with another student in this course (max team size = 2).

Consider CustomizedHangman.java.
Develop at least 4 JUnit tests to evaluate CustomizedHangman class. Each test must verify different fact. You should add your JUnit tests to CustomizedHangmanTest.java.

Consider the lostStick() method of CustomizedHangman class.

If it has   if (sticksRemaining < 0)    which is a faulty version instead of    if (sticksRemaining == 0).
Can the tests you created previously detect this fault? If not, design and automate test(s) that can detect this fault.
Note: to test, please comment the line of code noted as "correct version" and uncomment the line of code noted as "faulty version."

Reminder: You are writing tests to check against CustomizedHangman.java. Thus, do not modify CustomizedHangman.java; it is your program under test.


Copyright © 2025 Upsorn Praphamontripong
Released under the Creative Commons License CC-BY-NC-SA 4.0 license.
Last updated 2025-09-04 21:19