JdbcMethodInvocationTest.java 1.4 KB
Newer Older
T
terrymanu 已提交
1
/*
T
terrymanu 已提交
2
 * Copyright 2016-2018 shardingsphere.io.
T
terrymanu 已提交
3 4 5 6
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
T
terrymanu 已提交
7
 *
T
terrymanu 已提交
8
 *     http://www.apache.org/licenses/LICENSE-2.0
T
terrymanu 已提交
9
 *
T
terrymanu 已提交
10 11 12 13 14 15 16 17
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * </p>
 */

18
package io.shardingsphere.core.jdbc.adapter.invocation;
T
terrymanu 已提交
19

20
import io.shardingsphere.core.exception.ShardingException;
T
terrymanu 已提交
21
import org.junit.Test;
T
terrymanu 已提交
22 23 24 25 26 27 28 29 30

public final class JdbcMethodInvocationTest {
    
    @Test
    public void assertInvokeSuccess() throws NoSuchMethodException, SecurityException {
        JdbcMethodInvocation actual = new JdbcMethodInvocation(String.class.getMethod("length"), new Object[] {});
        actual.invoke("");
    }
    
31
    @Test(expected = ShardingException.class)
T
terrymanu 已提交
32 33 34 35 36
    public void assertInvokeFailure() throws NoSuchMethodException, SecurityException {
        JdbcMethodInvocation actual = new JdbcMethodInvocation(String.class.getDeclaredMethod("indexOfSupplementary", int.class, int.class), new Object[] {1, 1});
        actual.invoke("");
    }
}