001/** 002 * This is part of HW0: Environment Setup and Java Introduction for CSE 331. 003 */ 004package hw3.test; 005import hw3.*; 006 007import org.junit.Test; 008import org.junit.BeforeClass; 009import static org.junit.Assert.*; 010 011/** 012 * BallTest is a simple glassbox test of the Ball class. 013 * 014 * @see hw3.Ball 015 */ 016public class BallTest { 017 018 private static Ball b = null; 019 020 private static final double BALL_VOLUME = 20.0; 021 private static final double JUNIT_DOUBLE_DELTA = 0.0001; 022 023 @BeforeClass 024 public static void setupBeforeTests() throws Exception { 025 b = new Ball(BALL_VOLUME); 026 } 027 028 /** Test to see that Ball returns the correct volume when queried. */ 029 @Test 030 public void testVolume() { 031 assertEquals("b.getVolume()", 032 BALL_VOLUME, b.getVolume(), JUNIT_DOUBLE_DELTA); 033 } 034 035}