001    /**
002     * This is part of HW2: Environment Setup and Java Introduction for CSE 331.
003     */
004    package hw2.test;
005    import hw2.*;
006    
007    import org.junit.Test;
008    import org.junit.BeforeClass;
009    import static org.junit.Assert.*;
010    
011    /**
012     * BallTest is a simple glassbox test of the Ball class.
013     *
014     * @see hw2.Ball
015     */
016    public 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    }