forked from HamaWhiteGG/langchain-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f12845
commit 959d271
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
langchain-core/src/test/java/com/hw/langchain/chains/query/constructor/JsonUtilsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.hw.langchain.chains.query.constructor; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import com.hw.langchain.schema.Document; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Map; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* @author zhangxiaojia002 | ||
* @date 2023/7/20 8:52 下午 | ||
**/ | ||
class JsonUtilsTest { | ||
|
||
@Test | ||
void jsonFormatDocuments(){ | ||
Document document = new Document( | ||
"test document content", Map.of("fileName", "test.txt")); | ||
List<Document> documentList = Arrays.asList(document); | ||
String documentStr = documentList.toString(); | ||
String documentJson = JsonUtils.toJsonStringWithIndent(documentList, 0); | ||
System.out.println(""); | ||
} | ||
} |