From a84e10107f04740b091c9917968eede90ed3c6eb Mon Sep 17 00:00:00 2001 From: 0007 <0007@qq.com> Date: Wed, 27 Aug 2025 19:58:12 +0800 Subject: [PATCH] Add File --- .../core/test/chain/ChainGetTest.java | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 agents-flex-core/src/test/java/com/agentsflex/core/test/chain/ChainGetTest.java diff --git a/agents-flex-core/src/test/java/com/agentsflex/core/test/chain/ChainGetTest.java b/agents-flex-core/src/test/java/com/agentsflex/core/test/chain/ChainGetTest.java new file mode 100644 index 0000000..28aeb35 --- /dev/null +++ b/agents-flex-core/src/test/java/com/agentsflex/core/test/chain/ChainGetTest.java @@ -0,0 +1,57 @@ +package com.agentsflex.core.test.chain; + +import com.agentsflex.core.chain.Chain; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Arrays; + +public class ChainGetTest { + + @Test + public void testGet() { + + AA aa = new AA(); + aa.bb = new BB(); + aa.bb.cc = "hello world"; + + Chain chain = new Chain(); + chain.set("aa", aa); + + Assert.assertNotNull(chain.get("aa")); + Assert.assertNotNull(chain.get("aa.bb")); + Assert.assertEquals("hello world", chain.get("aa.bb.cc")); + + System.out.println(chain.get("aa.bb")); + System.out.println(chain.get("aa.bb.cc")); + } + + @Test + public void testGet2() { + + AA aa1 = new AA(); + aa1.bb = new BB(); + aa1.bb.cc = "hello world1"; + + AA aa2 = new AA(); + aa2.bb = new BB(); + aa2.bb.cc = "hello world2"; + + Chain chain = new Chain(); + chain.set("aa", Arrays.asList(aa1, aa2)); + //memory.put("aa", Arrays.asList(aa1, aa2)); + + System.out.println(chain.get("aa.bb.cc")); + // List : "hello world1","hello world2"; + } + + + // 测试类 + public static class AA { + public BB bb; + } + + public static class BB { + public String cc; + } +}