import org.junit.jupiter.api.Assertions;import org.junit.jupiter.api.Test;import src.memento.Snapshot;import src.memento.SnapshotHolder;import src.memento.StringUtil;import src.state.Kettle;/*** @author: chenbihao* @create: 2021年9月6日* @Description:* @History:*/public class MementoTest {@Testpublic void test() {StringUtil stringUtil = new StringUtil();SnapshotHolder snapshotHolder = new SnapshotHolder();stringUtil.append("张三");snapshotHolder.save(stringUtil);Assertions.assertEquals("张三",stringUtil.getText());stringUtil.append("是法外狂徒");Assertions.assertEquals("张三是法外狂徒",stringUtil.getText());// 发现输错了 撤销一下snapshotHolder.undo(stringUtil);Assertions.assertEquals("张三",stringUtil.getText());stringUtil.append("李四");snapshotHolder.save(stringUtil);Assertions.assertEquals("张三李四",stringUtil.getText());}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。