CSci 435/535: Homework 3

Implementation Tools #2

Due Friday, February 4th by 11am

Summary

This assignment is an introduction to Javadoc and JUnit.

Javadoc Comments

Javadoc Tags

Javadoc in Eclipse

  1. Download Student.java and TestStudent.java. Don't worry if TestStudent.java has errors right now.
  2. Create a new project in Eclipse called <USER-NAME>-HW3 and import the two files into it. (File → Import → File System.)
  3. Add Javadoc comments for all the attributes and methods of the Student class that are missing them. Also, add yourself as an author of the class.
  4. Right-click on the project name and go to Export → Javadoc.
  5. If you are in Windows, you will have to configure Eclipse to point to javadoc.exe in the bin directory of wherever you installed Java.
  6. After you click Finish, a directory called doc will be created in the HW3 project that has the generated documentation files. Take a look at the Student.html file in the doc folder using a browser.
  7. You can also use javadoc on the command line by running javadoc <FILE_NAME>

JUnit in Eclipse

  1. The first thing you must to to use JUnit in Eclipse is to import junit.jar. Right-click on the project name, and choose Properties. In the tree on the left, select Java Build Path. Next, choose Add External JARs and browse to find junit.jar. If you are using Windows, it will be located in <eclipsedir>\plugins\org.junit_<version number>\junit.jar. On department machines, it is under /usr/local/eclipse/plugins/org.junit_3.8.1/junit.jar.
  2. To create a test case, go to New → Other → Java → JUnit → Junit Test Case. You do not have to do this now because you have already been given a test case in TestStudent.java.
  3. TestStudent is a subclass of TestCase, so it inherits a variety of testing assertions. These include assertEquals, assertTrue/False, assertSame/NotSame, and assertNull/NotNull. There is also a fail() method that just causes the current TestCase to fail.
  4. To run the test case, right-click on TestStudent.java and go to Run → JUnit Test. There should be two failures. Why? In the Javadoc comments at the top of TestStudent.java, explain why there were failures.
  5. Debug these failures so that the test cases pass. Do not change the test cases!
  6. Save all your changes and then zip up the HW3 project. Go to File → Export → Zip File. If your username is txjeff, name your file txjeff-HW3.zip. E-mail your zip file to csci435@coppit.org.

Grading

75 points total

Back Back to CSci 435/535 Homepage.

Last changed February 03 2006 10:00:46. David Coppit, coppit@cs.wm.edu

There have been 1221252 hits since Thu Jun 9 14:49:55 2005

Valid CSS!
Valid HTML 4.01!