package br.usp.each.saeg.jaguar.model;

import org.junit.Assert;
import org.junit.Test;

import java.math.BigDecimal;

/**
 * Created by henrique on 7/9/17.
 */
public class SuspiciousElementTest {

    @Test
    public void compareEqual(){
        LineRequirement line = new LineRequirement();
        line.setSuspiciousValue(new BigDecimal(100));

        LineRequirement line2 = new LineRequirement();
        line2.setSuspiciousValue(new BigDecimal(100));

        Assert.assertEquals(0, line.compareTo(line2));
    }

    @Test
    public void compareBigger(){
        LineRequirement line = new LineRequirement();
        line.setSuspiciousValue(new BigDecimal(100));

        LineRequirement line2 = new LineRequirement();
        line2.setSuspiciousValue(new BigDecimal(200));

        Assert.assertEquals(-1, line.compareTo(line2));
    }

    @Test
    public void compareSmaller(){
        LineRequirement line = new LineRequirement();
        line.setSuspiciousValue(new BigDecimal(400));

        LineRequirement line2 = new LineRequirement();
        line2.setSuspiciousValue(new BigDecimal(200));

        Assert.assertEquals(1, line.compareTo(line2));
    }

    @Test
    public void equalToEqual(){
        LineRequirement line = new LineRequirement();
        line.setLocation("package.Class.Method:12");

        LineRequirement line2 = new LineRequirement();
        line2.setLocation("package.Class.Method:12");

        Assert.assertTrue(line.equals(line2));
    }

    @Test
    public void equalToNotEqual(){
        LineRequirement line = new LineRequirement();
        line.setLocation("package.Class.Method:12");

        LineRequirement line2 = new LineRequirement();
        line2.setLocation("package.Class.Method:0123");

        Assert.assertFalse(line.equals(line2));
    }

    @Test
    public void hashEqual(){
        LineRequirement line = new LineRequirement();
        line.setLocation("package.Class.Method:12");

        LineRequirement line2 = new LineRequirement();
        line2.setLocation("package.Class.Method:12");

        Assert.assertTrue(line.equals(line2));
    }

    @Test
    public void hashNotEqual() {
        LineRequirement line = new LineRequirement();
        line.setLocation("package.Class.Method:12");

        LineRequirement line2 = new LineRequirement();
        line2.setLocation("package.Class.Method:0123");

        Assert.assertFalse(line.equals(line2));
    }
}

@@ -115,87 +115,1294 @@
 al;%0A
-%0A/**%0A * Created by henrique on 7/9/17.%0A */%0Apublic class SuspiciousElementTest %7B
+import java.util.Collections;%0A%0A/**%0A * To test the basic model.%0A * LineRequirement, Requirement, Suspicious Element%0A *%0A * Created by henrique on 7/9/17.%0A */%0Apublic class SuspiciousElementTest %7B%0A%0A    @Test%0A    public void testSetAndGet()%7B%0A        LineRequirement line = new LineRequirement();%0A        line.setSuspiciousValue(new BigDecimal(100));%0A        line.setLocation(%22package.Class:11%22);%0A        line.setPosition(11);%0A        line.setCef(1);%0A        line.setCep(2);%0A        line.setCnf(3);%0A        line.setCnp(4);%0A%0A        Assert.assertEquals(Requirement.Type.LINE, line.getType());%0A        Assert.assertEquals(new BigDecimal(100), line.getSuspiciousValue());%0A        Assert.assertEquals(%22package.Class:11%22, line.getLocation());%0A        Assert.assertEquals(new Integer(11), line.getPosition());%0A        Assert.assertEquals(new Integer(1), line.getCef());%0A        Assert.assertEquals(new Integer(2), line.getCep());%0A        Assert.assertEquals(new Integer(3), line.getCnf());%0A        Assert.assertEquals(new Integer(4), line.getCnp());%0A        Assert.assertEquals(Collections.EMPTY_LIST, line.getChildren());%0A        Assert.assertEquals(%22LineRequirement%7BType='LINE', location='package.Class:11', position=11, suspiciousValue=100, cef=1, cep=2, cnf=3, cnp=4%7D%22, line.toString());%0A%0A    %7D
 %0A%0A  

Add test for get and set