Esempio n. 1
0
 @Test
 public void divisionByZeroShouldGiveInfinity() {
   ExpressionResolver resolver = new ExpressionResolver();
   ExpressionResolver spy = spy(resolver);
   Double result = spy.solveSimpleTerm(new Double(1), new Double(0), "DIV");
   assertEquals(result, new Double(POSITIVE_INFINITY));
 }
 @Test
 public void multiplicationIfNegativesShouldBeCorrect() {
   ExpressionResolver resolver = new ExpressionResolver();
   ExpressionResolver spy = spy(resolver);
   Double result = spy.solveSimpleTerm(new Double(1), new Double(-2), "MUL");
   assertEquals(result, new Double(-2));
 }
Esempio n. 3
0
 @Test
 public void divisionOfNegativesShouldBeCorrect() {
   ExpressionResolver resolver = new ExpressionResolver();
   ExpressionResolver spy = spy(resolver);
   Double result = spy.solveSimpleTerm(new Double(-1), new Double(2), "DIV");
   assertEquals(result, new Double(-0.5));
 }