package ch.hevs.aislab.magpie.test.java;


import org.junit.Test;

import alice.tuprolog.Term;
import ch.hevs.aislab.magpie.event.LogicTupleEvent;

import static junit.framework.TestCase.assertEquals;

public class LogicTupleTest {

    @Test
    public void createLogicTuple() {

        // This method tests if the following LogicTuple is created correctly using the different constructors
        final String logicTuple = "blood_pressure(Sys,Dias)";

        // Creation with multiple arguments
        LogicTupleEvent bp1 = new LogicTupleEvent("blood_pressure", "Sys", "Dias");
        String tupleFromArgs = bp1.toTuple();
        assertEquals(logicTuple, tupleFromArgs);

        // Creation from a tuProlog Term
        Term t = Term.createTerm(logicTuple);
        LogicTupleEvent bp2 = new LogicTupleEvent(t);
        String tupleFromTerm = bp2.toTuple();
        assertEquals(logicTuple, tupleFromTerm);

        // Creation from String
        LogicTupleEvent bp3 = new LogicTupleEvent(logicTuple);
        String tupleFromString = bp3.toTuple();
        assertEquals(logicTuple, tupleFromString);
    }
}

@@ -1108,11 +1108,387 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void getNameAndArguments() %7B%0A%0A        String name = %22blood_pressure%22;%0A        String arg1 = %22Sys%22;%0A        String arg2 = %22Dias%22;%0A        LogicTupleEvent ev = new LogicTupleEvent(name, arg1, arg2);%0A%0A        assertEquals(name, ev.getName());%0A        assertEquals(arg1, ev.getArguments().get(0));%0A        assertEquals(arg2, ev.getArguments().get(1));%0A    %7D
 %0A%7D%0A

Add test that checks whether the name and the arguments are correct