[Delete] Core, Framework-API 移除 BotCode 的 'getPlatform' 方法;

[Delete] BotCode 移除目前尚未使用的 'getPlatform' 方法, 该方法在开发 BotCode 具体实现时带来了一些麻烦;
[Delete] BasicBotCode, BasicBotCodeTest, AbstractBotCode, AbstractBotCodeTest, MessageChainTest 适配修改;
This commit is contained in:
LamGC 2021-02-03 12:13:32 +08:00
parent 672be33866
commit 612956b594
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D
6 changed files with 2 additions and 41 deletions

View File

@ -47,11 +47,6 @@ public class BasicBotCode extends AbstractBotCode {
super(function, functionProperties);
}
@Override
public Platform getPlatform() {
return PLATFORM;
}
@Override
public String contentToString() {
StringBuilder builder = new StringBuilder('[' + getFunction().getFunctionName());

View File

@ -17,7 +17,6 @@
package net.lamgc.cgj.bot.framework.base;
import net.lamgc.cgj.bot.framework.Platform;
import net.lamgc.cgj.bot.framework.message.AbstractBotCode;
import net.lamgc.cgj.bot.framework.message.BotCode;
import net.lamgc.cgj.bot.framework.message.BotCodeFunction;
@ -33,14 +32,6 @@ import java.util.Map;
*/
public class BasicBotCodeTest {
@Test
public void getPlatform() {
BotCode botCode = new BasicBotCode(StandardBotCodeFunction.AT);
Assert.assertEquals("ContentGrabbingJi", botCode.getPlatform().getPlatformName());
Assert.assertEquals("CGJ", botCode.getPlatform().getPlatformIdentify());
}
@Test
public void contentToStringWithoutParameter() {
BotCode botCode = new BasicBotCode(StandardBotCodeFunction.FILE);
@ -67,11 +58,6 @@ public class BasicBotCodeTest {
super(function, functionProperties);
}
@Override
public Platform getPlatform() {
return null;
}
@Override
public String contentToString() {
return null;

View File

@ -72,7 +72,6 @@ public abstract class AbstractBotCode implements BotCode {
mapString.delete(mapString.length() - 2, mapString.length());
}
return this.getClass().getSimpleName() + '@' + Integer.toHexString(this.hashCode()) + '{' +
"Platform=" + getPlatform() + ", " +
"functionName='" + function.getFunctionName() + '\'' +
", functionProperties={" + mapString.toString() + '}' +
'}';

View File

@ -17,8 +17,6 @@
package net.lamgc.cgj.bot.framework.message;
import net.lamgc.cgj.bot.framework.Platform;
import java.util.Set;
/**
@ -28,12 +26,6 @@ import java.util.Set;
@SuppressWarnings("AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc")
public interface BotCode extends Message {
/**
* 获取 BotCode 实现所属平台.
* @return 返回所属平台.
*/
Platform getPlatform();
/**
* 取功能函数名.
* @return 返回功能函数名.

View File

@ -17,7 +17,6 @@
package net.lamgc.cgj.bot.framework.message;
import net.lamgc.cgj.bot.framework.Platform;
import org.junit.Assert;
import org.junit.Test;
@ -125,13 +124,13 @@ public class AbstractBotCodeTest {
public void toStringTest() {
BotCode botCode = new TestBotCode("function");
String objectStr = botCode.getClass().getSimpleName() + '@' + Integer.toHexString(botCode.hashCode());
Assert.assertEquals(objectStr + "{Platform=null, functionName='function', " +
Assert.assertEquals(objectStr + "{functionName='function', " +
"functionProperties={Hashtable}}", botCode.toString());
botCode.setProperty("arg1", "value1");
botCode.setProperty("arg2", "测试");
botCode.setProperty("arg3", "Hello World.");
Assert.assertEquals(objectStr + "{Platform=null, functionName='function', " +
Assert.assertEquals(objectStr + "{functionName='function', " +
"functionProperties={Hashtable{\"arg1\"='value1', \"arg2\"='测试', \"arg3\"='Hello World.'}}",
botCode.toString());
}
@ -154,11 +153,6 @@ public class AbstractBotCodeTest {
super(function, functionProperties);
}
@Override
public Platform getPlatform() {
return null;
}
@Override
public String contentToString() {
return null;

View File

@ -76,11 +76,6 @@ public class MessageChainTest {
public void plusBotCodeTest() {
MessageChain chain = new MessageChain("BotCode: ");
chain.plus(new AbstractBotCode(StandardBotCodeFunction.AT) {
@Override
public Platform getPlatform() {
return null;
}
@Override
public String contentToString() {
return "[at:arg=value]";