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 */ 016@SuppressWarnings("nullness") 017public class BallTest { 018 019 private static Ball b = null; 020 021 private static final double BALL_VOLUME = 20.0; 022 private static final double JUNIT_DOUBLE_DELTA = 0.0001; 023 024 @BeforeClass 025 public static void setupBeforeTests() throws Exception { 026 b = new Ball(BALL_VOLUME); 027 } 028 029 /** Test to see that Ball returns the correct volume when queried. */ 030 @Test 031 public void testVolume() { 032 assertEquals("b.getVolume()", 033 BALL_VOLUME, b.getVolume(), JUNIT_DOUBLE_DELTA); 034 } 035 036}