You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/09/15 15:44:32 UTC

[shardingsphere] branch master updated: Add test case for MethodInvocation (#7466)

This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 7e7e252  Add test case for MethodInvocation (#7466)
7e7e252 is described below

commit 7e7e252f93e4c54c6c2c6def3ab4b3e24415b09d
Author: Serendipity <ja...@163.com>
AuthorDate: Tue Sep 15 23:44:09 2020 +0800

    Add test case for MethodInvocation (#7466)
    
    * Add test case for MethodInvocation
    
    * adjust code style
---
 .../jdbc/connection/MethodInvocationTest.java      | 37 ++++++++++++++++++++++
 .../fixture/MethodInvocationFixture.java           | 29 +++++++++++++++++
 2 files changed, 66 insertions(+)

diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/MethodInvocationTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/MethodInvocationTest.java
new file mode 100644
index 0000000..41745cc
--- /dev/null
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/MethodInvocationTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+package org.apache.shardingsphere.proxy.backend.communication.jdbc.connection;
+
+import lombok.SneakyThrows;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.fixture.MethodInvocationFixture;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public final class MethodInvocationTest {
+    
+    @SneakyThrows
+    @Test
+    public void assertInvoke() {
+        MethodInvocationFixture methodInvocationFixture = new MethodInvocationFixture();
+        MethodInvocation methodInvocation = new MethodInvocation(MethodInvocationFixture.class.getMethod("setId", Integer.class), new Object[]{1});
+        methodInvocation.invoke(methodInvocationFixture);
+        assertThat(methodInvocationFixture.getId(), is(1));
+    }
+}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/fixture/MethodInvocationFixture.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/fixture/MethodInvocationFixture.java
new file mode 100644
index 0000000..72ff120
--- /dev/null
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/fixture/MethodInvocationFixture.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+package org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.fixture;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public final class MethodInvocationFixture {
+    
+    private Integer id;
+}
+