@Test public void test_executeNegative() throws Exception { Operation operation = new SubtractOperation(BigDecimal.valueOf(1)); BigDecimal result = operation.execute(BigDecimal.valueOf(-3)); // -3 - 1 assertTrue(result.compareTo(BigDecimal.valueOf(-4)) == 0); }
@Test(expected = NullPointerException.class) public void test_executeNull_NullPointerException() throws Exception { Operation operation = new SubtractOperation(BigDecimal.valueOf(2)); operation.execute(null); }