@@ -0,0 +1,3270 @@
+/*%0A *  Copyright 1999-2018 Alibaba Group Holding Ltd.%0A *%0A *  Licensed under the Apache License, Version 2.0 (the %22License%22);%0A *  you may not use this file except in compliance with the License.%0A *  You may obtain a copy of the License at%0A *%0A *       http://www.apache.org/licenses/LICENSE-2.0%0A *%0A *  Unless required by applicable law or agreed to in writing, software%0A *  distributed under the License is distributed on an %22AS IS%22 BASIS,%0A *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A *  See the License for the specific language governing permissions and%0A *  limitations under the License.%0A */%0A%0Apackage com.alibaba.fescar.spring.annotation;%0A%0Aimport org.junit.Test;%0A%0Aimport java.lang.reflect.InvocationTargetException;%0Aimport java.lang.reflect.Method;%0Aimport static org.assertj.core.api.Assertions.assertThat;%0A%0A/**%0A * @author Wu%0A * @date 2019/3/8%0A */%0Apublic class MethodDescTest %7B%0A%0A    private static final GlobalTransactionScanner GLOBAL_TRANSACTION_SCANNER = new GlobalTransactionScanner(%22global-trans-scanner-test%22);%0A    private static Method method = null;%0A    private static GlobalTransactional transactional = null;%0A%0A    public MethodDescTest() throws NoSuchMethodException %7B%0A        method = MockBusiness.class.getDeclaredMethod(%22doBiz%22, String.class);%0A        transactional = method.getAnnotation(GlobalTransactional.class);%0A    %7D%0A%0A    @Test%0A    public void testGetTransactionAnnotation() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException %7B%0A        MethodDesc methodDesc = getMethodDesc();%0A        assertThat(methodDesc.getTransactionAnnotation()).isEqualTo(transactional);%0A%0A    %7D%0A%0A    @Test%0A    public void testGetMethod() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException %7B%0A        MethodDesc methodDesc = getMethodDesc();%0A        assertThat(methodDesc.getMethod()).isEqualTo(method);%0A    %7D%0A%0A    @Test%0A    public void testSetTransactionAnnotation() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException %7B%0A        MethodDesc methodDesc = getMethodDesc();%0A        assertThat(methodDesc.getTransactionAnnotation()).isNotNull();%0A        methodDesc.setTransactionAnnotation(null);%0A        assertThat(methodDesc.getTransactionAnnotation()).isNull();%0A    %7D%0A%0A    @Test%0A    public void testSetMethod() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException %7B%0A        MethodDesc methodDesc = getMethodDesc();%0A        assertThat(methodDesc.getMethod()).isNotNull();%0A        methodDesc.setMethod(null);%0A        assertThat(methodDesc.getMethod()).isNull();%0A    %7D%0A%0A%0A    private MethodDesc getMethodDesc() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException %7B%0A        //call the private method%0A        Method m = GlobalTransactionScanner.class.getDeclaredMethod(%22makeMethodDesc%22, GlobalTransactional.class, Method.class);%0A        m.setAccessible(true);%0A        return (MethodDesc) m.invoke(GLOBAL_TRANSACTION_SCANNER, transactional, method);%0A%0A    %7D%0A%0A    /**%0A     * the type mock business%0A     */%0A    private static class MockBusiness %7B%0A        @GlobalTransactional(timeoutMills = 300000, name = %22busi-doBiz%22)%0A        public String doBiz(String msg) %7B%0A            return %22hello %22 + msg;%0A        %7D%0A    %7D%0A%0A%7D%0A

Add test cases for MethodDesc (#559)