This is an automated email from the ASF dual-hosted git repository.
hefengen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 8a2a23dc17 [type:test][ISSUE #4775] Add test case for ShenYu sdk core
(#5267)
8a2a23dc17 is described below
commit 8a2a23dc17bdbbad9b8fb57a1f24ff0553e483f4
Author: YxYL <[email protected]>
AuthorDate: Thu Nov 2 16:19:11 2023 +0800
[type:test][ISSUE #4775] Add test case for ShenYu sdk core (#5267)
* [type:test][ISSUE apache#4537] Add test case for
org.apache.shenyu.sdk.core.ShenyuRequest
* [type:test][ISSUE apache#4537] Add test case for
org.apache.shenyu.sdk.core.ShenyuResponse
* [type:test][ISSUE apache#4537] Add test case for
org.apache.shenyu.sdk.core.ShenyuResponse
* [type:test][ISSUE apache#4537] Add test case for
org.apache.shenyu.sdk.core.ShenyuRequest
---------
Co-authored-by: moremind <[email protected]>
---
.../apache/shenyu/sdk/core/ShenyuRequestTest.java | 43 ++++++++++++++++++
.../apache/shenyu/sdk/core/ShenyuResponseTest.java | 51 ++++++++++++++++++++++
2 files changed, 94 insertions(+)
diff --git
a/shenyu-sdk/shenyu-sdk-core/src/test/java/org/apache/shenyu/sdk/core/ShenyuRequestTest.java
b/shenyu-sdk/shenyu-sdk-core/src/test/java/org/apache/shenyu/sdk/core/ShenyuRequestTest.java
new file mode 100644
index 0000000000..f65a92e47c
--- /dev/null
+++
b/shenyu-sdk/shenyu-sdk-core/src/test/java/org/apache/shenyu/sdk/core/ShenyuRequestTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.shenyu.sdk.core;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Test for {@link ShenyuRequest}.
+ */
+public class ShenyuRequestTest {
+
+ @Test
+ public void testShenyuRequest() {
+ Map<String, Collection<String>> headerMap = new HashMap<>();
+ headerMap.put("header", Arrays.asList("header1", "header2"));
+ ShenyuRequest request =
ShenyuRequest.create(ShenyuRequest.HttpMethod.GET, "https://shenyu.apache.org",
+ headerMap, null, null, null);
+
+ Assert.assertNotNull(request);
+ }
+
+}
diff --git
a/shenyu-sdk/shenyu-sdk-core/src/test/java/org/apache/shenyu/sdk/core/ShenyuResponseTest.java
b/shenyu-sdk/shenyu-sdk-core/src/test/java/org/apache/shenyu/sdk/core/ShenyuResponseTest.java
new file mode 100644
index 0000000000..f05be79555
--- /dev/null
+++
b/shenyu-sdk/shenyu-sdk-core/src/test/java/org/apache/shenyu/sdk/core/ShenyuResponseTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.shenyu.sdk.core;
+
+import org.apache.http.HttpStatus;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Test for {@link ShenyuResponse}.
+ */
+public class ShenyuResponseTest {
+
+ @Test
+ public void testShenyuResponse() {
+ Map<String, Collection<String>> headerMap = new HashMap<>();
+ headerMap.put("header", Arrays.asList("header1", "header2"));
+ String body = "{key1:\"value1\"}";
+ ShenyuRequest request =
ShenyuRequest.create(ShenyuRequest.HttpMethod.GET, "https://shenyu.apache.org",
+ headerMap, null, null, null);
+
+ ShenyuResponse response = new ShenyuResponse(
+ HttpStatus.SC_OK,
+ "success",
+ headerMap,
+ body,
+ request
+ );
+ Assert.assertNotNull(response);
+ }
+}