First Commit

This commit is contained in:
Administrator
2025-05-12 12:04:42 +08:00
commit 6a5e13974c
1248 changed files with 366157 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
package quant.rich;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.util.Map;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import quant.rich.emoney.patch.okhttp.RequestContext;
import quant.rich.emoney.patch.okhttp.PatchOkHttpRule;
public class PatchOkHttpTest {
@Test
void test() {
PatchOkHttpRule rule;
RequestContext context;
rule = PatchOkHttpRule.when().isHttps().build();
context = new RequestContext(Map.of(), "https", "localhost");
Assertions.assertTrue(rule.matches(context), "测试失败");
rule = PatchOkHttpRule.when().hostEndsWith("emoney.com")
.or(r -> r.hostContains("emapp"))
.build();
context = new RequestContext(Map.of(), "https", "mbs.emoney.com");
Assertions.assertTrue(rule.matches(context), "测试失败");
context = new RequestContext(Map.of(), "https", "emapp-static.oss-cn-shanghai.aliyuncs.com");
Assertions.assertTrue(rule.matches(context), "测试失败");
context = new RequestContext(Map.of(), "https", "hao123.com");
Assertions.assertFalse(rule.matches(context), "测试失败");
//Assertions.assertEquals("{\"info\":\"m\",\"weight\":\"100kg/m\"}", JSON.toJSONString(humanWeight));
}
}