CSCI 540: Object-Oriented Development

You will be graded on how well you unit test your code and identify a
reasonable number of edge cases. In addition, your test cases should also
be reasonably documented, i.e., comments.
In this assignment you will be writing JUnit test cases for the stack and
queue implementations you developed in assignment #2.
In eclipse, or whatever IDE you are using, you should have (2) source
...src/main/java (contains assignment source code)
...src/test/java (contains test source code)

There are a number of JUnit tutorial and examples that you can find on the
internet. You can focus your search on using JUnit with eclipse for those
who are using it.
As usual, please post your questions to piazza so that your classmates can


You should create a JUnit test cases for every public method of your stack
and queue implementations. Some of your classes may contain private
"helper" classes that I assume will be executed when your public methods
are invoked. So, you do not have to break encapsulation to test your
private methods.

Here are some additional requirements/suggestions

1. Package structure of class to be tested and test class should be the

So, for example, if you created your stack implementation under then the corresponding test case should use
the same package structure.

2. Naming convention of test classes

If the class to be tested is Stack then the corresponding JUnit class
should be called StackTest

3. Naming convention of test methods

If, for example, you are testing method pop() in Stack then use something
similar to:
testPopIsEmpty() {

test indicates a test case
Pop indicates name of the method that is being tested
IsEmpty gives a descriptive indicator in the name of the method of what is
being tested


Be sure to document your JUnit test cases using javadocs

Submitting Your Work

When you have completed this assignment and tested your code thoroughly,
create a .zip file with your work. The zip file should contain source code
only (i.e., no .class files) and only contain the contents of your
src/main/java and src/test/java contents.

E-mail your final submission to

Make sure to keep a copy of your work just in case!