package com.hdsp.expressionevaluator;


import com.hdsp.expressionevaluator.expressions.Add;
import com.hdsp.expressionevaluator.expressions.Constant;
import com.hdsp.expressionevaluator.expressions.Sub;
import org.junit.Test;

import static junit.framework.Assert.assertEquals;


public class ExpressionEvaluatorTest {

    @Test
    public void withIntegerConstant() throws Exception {
        Evaluable evaluable = new Constant(5);
        assertEquals(5,evaluable.value());
        assertEquals("Integer",evaluable.type());
    }

    @Test
    public void withIntegerAddition() throws Exception {
        Evaluable evaluable = new Add(new Constant(3), new Constant(5));
        assertEquals(8, evaluable.value());
        assertEquals("Integer",evaluable.type());
    }

    @Test
    public void withFloatIntegerAddition() throws Exception {
        Evaluable evaluable = new Add(new Constant(5.0f), new Constant(3));
        assertEquals(8.0f, evaluable.value());
        assertEquals("Float",evaluable.type());
    }

    @Test
    public void withIntegerFloatAddition() throws Exception {
        Evaluable evaluable = new Add(new Constant(4) , new Constant(5.0f));
        assertEquals(9.0f, evaluable.value());
        assertEquals("Float",evaluable.type());
    }

    @Test
    public void withFloatAddition() throws Exception {
        Evaluable evaluable = new Add(new Constant(2.0f) , new Constant(5.0f));
        assertEquals(7.0f, evaluable.value());
        assertEquals("Float",evaluable.type());
    }

    @Test
    public void withDoubleAddition() throws Exception {
        Evaluable evaluable = new Add(new Constant(2.0d) , new Constant(2.0d));
        assertEquals(4.0d, evaluable.value());
        assertEquals("Double",evaluable.type());
    }

    @Test
    public void withIntegerSubtraction() throws Exception {
        Evaluable evaluable = new Sub(new Constant(5) , new Constant(3));
        assertEquals(2, evaluable.value());
        assertEquals("Integer",evaluable.type());
    }


}

@@ -488,33 +488,53 @@
 ssertEquals(
-%22
 Integer
-%22
+.class.getSimpleName()
 ,evaluable.t
@@ -749,33 +749,53 @@
 ssertEquals(
-%22
 Integer
-%22
+.class.getSimpleName()
 ,evaluable.t
@@ -1017,39 +1017,59 @@
    assertEquals(
-%22
 Float
-%22
+.class.getSimpleName()
 ,evaluable.type(
@@ -1288,39 +1288,59 @@
    assertEquals(
-%22
 Float
-%22
+.class.getSimpleName()
 ,evaluable.type(
@@ -1567,15 +1567,35 @@
 als(
-%22
 Float
-%22
+.class.getSimpleName()
 ,eva
@@ -1835,16 +1835,36 @@
 als(
-%22
 Double
-%22
+.class.getSimpleName()
 ,eva
@@ -2099,17 +2099,311 @@
 als(
-%22Integer%22
+Integer.class.getSimpleName(),evaluable.type());%0A    %7D%0A%0A    @Test%0A    public void withIntegerFloatSubtraction() throws Exception %7B%0A        Evaluable evaluable = new Sub(new Constant(5) , new Constant(3.0f));%0A        assertEquals(2.0f, evaluable.value());%0A        assertEquals(Float.class.getSimpleName()
 ,eva

Test Refactor