Home CPSC 330

Test Driven Development


To get experience using the JUnit testing library and doing test-driven development.


For this lab, you will write a class for representing a sphere. You will also write a unit test for the class. Following the idea of test-driven development, you will write the unit test first.

The sphere should store its radius, and have methods for computing the surface area and volume.


  1. Start by creating a unit test class, perhaps called SphereTest.
  2. Add test cases for testing the sphere's volume and surface area with a few tests.
  3. Once the test is written, work on implementing the Sphere class.
  4. When the test case passes, you're done.


When your program is done, email the code to ifinlay@umw.edu.

Copyright © 2018 Ian Finlayson | Licensed under a Creative Commons Attribution 4.0 International License.