package org.x2a.cutter;

import org.junit.Assert;
import org.junit.Test;
import org.x2a.cutter.annotation.Cut;
import org.x2a.cutter.cut.Parameter;

public class TestCutUtils {

    @Test
    public void testCreateParameterArray() {
        Object[] objects = new Object[]{"x", int.class, 9, "y", Integer.class, 12, "str", String.class, "foobar"};

        Parameter[] parameters = Cut.Utils.toParameters(objects);
        Assert.assertEquals(3, parameters.length);

        Assert.assertEquals(int.class, parameters[0].getClazz());
        Assert.assertEquals(Integer.class, parameters[1].getClazz());
        Assert.assertEquals(String.class, parameters[2].getClazz());

        Assert.assertEquals("x", parameters[0].getName());
        Assert.assertEquals("y", parameters[1].getName());
        Assert.assertEquals("str", parameters[2].getName());

        Assert.assertEquals(9, parameters[0].getOriginalValue());
        Assert.assertEquals(12, parameters[1].getOriginalValue());
        Assert.assertEquals("foobar", parameters[2].getOriginalValue());

        Assert.assertEquals(parameters[0].getCurrentValue(), parameters[0].getOriginalValue());
    }
}

@@ -104,16 +104,53 @@
 on.Cut;%0A
+import org.x2a.cutter.cut.JoinPoint;%0A
 import o
@@ -1192,10 +1192,391 @@
 ;%0A    %7D%0A
+%0A%0A    @Test%0A    public void testCreateJoinPoint() %7B%0A        JoinPoint jp = Cut.Utils.createJoinPoint(this.getClass(), %22test%22);%0A        Assert.assertNotNull(jp);%0A%0A        Assert.assertEquals(this.getClass(), jp.getClazz());%0A        Assert.assertEquals(%22test%22, jp.getMethodName());%0A        Assert.assertEquals(Constants.METHOD_WRAPPED_PREFIX + %22test%22, jp.getRealMethodName());%0A    %7D%0A
 %7D%0A

add unit test