import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; /** * The test class CoreFeaturesTest. * * @author (your name) * @version (a version number or a date) */ public class CoreFeaturesTest { private Console console = new Console(); private CoreFeatures core = new CoreFeatures(console); @Test public void addTest() { console.changeCurrentValue(2); double testAdd = core.add(2); assertEquals(4, testAdd, 0); } @Test public void minusTest() { console.changeCurrentValue(2); double testMinus = core.subtract(2); assertEquals(0, testMinus, 0); } @Test public void timesTest() { console.changeCurrentValue(2); double testTimes = core.multiply(2); assertEquals(4, testTimes, 0); } @Test public void divideTest() { console.changeCurrentValue(2); double testDivide = core.divide(2); assertEquals(1, testDivide, 0); } @Test public void squareTest() { console.changeCurrentValue(2); double testSquare = core.square(); assertEquals(4, testSquare, 0); } @Test public void sqrtTest() { console.changeCurrentValue(4); double testSqrt = core.squareRoot(); assertEquals(2, testSqrt, 0); } @Test public void inverseTest() { console.changeCurrentValue(2); double testInverse = core.inverse(); assertEquals(.5, testInverse, 0); } @Test public void changeSignTest() { console.changeCurrentValue(2); double testChangeSign = core.changeSign(); assertEquals(-2, testChangeSign, 0); } @Test public void variableExponentiationTest() { console.changeCurrentValue(2); double testVariableExponentiation = core.variableExponentiation(2); assertEquals(4, testVariableExponentiation, 0); } @Test public void getValueTest() { console.changeCurrentValue(2); double testGetValue = console.getCurrentValue(); assertEquals(2, testGetValue, 0); } @Test public void clearValueTest() { double testClearValue = console.clearCurrentValue(); assertEquals(0, testClearValue, 0); } @Test public void changeValueTest() { double testChangeValue = console.changeCurrentValue(9); assertEquals(9, testChangeValue, 0); } }