package com.elab.spring.intercept;

import com.elab.spring.componts.DefaultExpression;
import com.elab.spring.config.AopConfig;
import com.elab.spring.test.TestAuthorAnnotation;
import com.elab.spring.test.UserModel;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.HashMap;
import java.util.Map;

@RunWith(SpringRunner.class)
//@EnableCaching
@EnableAspectJAutoProxy
@SpringBootTest(classes = {AopConfig.class, DefaultExpression.class, AuthorDescriptionAnnotationProcess.class,
    TestAuthorAnnotation.class})
public class AuthorDescriptionAnnotationProcessTest {

    @Autowired
    private TestAuthorAnnotation testAnnotation;

    @Test
    public void testInvokeWithinTransaction() {
        Map<String, String> request = new HashMap<>();
        request.put("id", "1314");
        request.put("username", "jayzhou");
        request.put("sex", "MAN");
        request.put("age", "13");

        UserModel userModel = new UserModel();
        userModel.setUserId("5555");
        userModel.setUsername("liukx");

        String test = testAnnotation.test(request, userModel);
        System.out.println(test);
    }

}



