OCT REM: 1. 修正代码检查问题
This commit is contained in:
parent
f36bb323f7
commit
ad3bb63a20
|
@ -267,9 +267,7 @@ public class AutoExternStringJsonProcessTest {
|
|||
public void serialize_WithFormatEnum_InvalidIndex_ShouldThrowException() {
|
||||
autoExternStringJsonProcess = new AutoExternStringJsonProcess("", "", UtilsFormatType.FORMAT_ENUM, "", ErrorCode.class, true);
|
||||
|
||||
assertThrows(NullPointerException.class, () -> {
|
||||
autoExternStringJsonProcess.serialize(100, jsonGenerator, serializerProvider);
|
||||
});
|
||||
assertThrows(NullPointerException.class, () -> autoExternStringJsonProcess.serialize(100, jsonGenerator, serializerProvider));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -281,9 +279,7 @@ public class AutoExternStringJsonProcessTest {
|
|||
public void serialize_WithFormatEnum_NonEnumClass_ShouldThrowException() {
|
||||
autoExternStringJsonProcess = new AutoExternStringJsonProcess("", "", UtilsFormatType.FORMAT_ENUM, "", TestEnum.class, true);
|
||||
|
||||
assertThrows(NullPointerException.class, () -> {
|
||||
autoExternStringJsonProcess.serialize(0, jsonGenerator, serializerProvider);
|
||||
});
|
||||
assertThrows(NullPointerException.class, () -> autoExternStringJsonProcess.serialize(0, jsonGenerator, serializerProvider));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -342,11 +338,10 @@ public class AutoExternStringJsonProcessTest {
|
|||
* 测试 {@link AutoExternStringJsonProcess#serialize(Number, JsonGenerator, SerializerProvider)} 方法,
|
||||
* 当格式为 {@link UtilsFormatType#FORMAT_ENUM} 时,如果发生异常,应该抛出 {@link CommonErrorCodeException}。
|
||||
*
|
||||
* @throws IOException 序列化时可能抛出的异常
|
||||
*/
|
||||
@Test
|
||||
@DisplayName("格式为枚举时发生异常抛出异常")
|
||||
public void serialize_WithFormatEnum_ThrowException() throws IOException {
|
||||
public void serialize_WithFormatEnum_ThrowException() {
|
||||
// 创建一个模拟的 JsonStreamContext 对象
|
||||
JsonStreamContext jsonStreamContext = mock(JsonStreamContext.class);
|
||||
when(jsonStreamContext.getCurrentName()).thenReturn("testField");
|
||||
|
@ -356,9 +351,7 @@ public class AutoExternStringJsonProcessTest {
|
|||
when(jsonGenerator.getOutputContext()).thenReturn(jsonStreamContext);
|
||||
autoExternStringJsonProcess = new AutoExternStringJsonProcess("", "", UtilsFormatType.FORMAT_ENUM, "", ErrorCode.class, true);
|
||||
|
||||
assertThrows(CommonErrorCodeException.class, () -> {
|
||||
autoExternStringJsonProcess.serialize(1000, jsonGenerator, serializerProvider);
|
||||
});
|
||||
assertThrows(CommonErrorCodeException.class, () -> autoExternStringJsonProcess.serialize(1000, jsonGenerator, serializerProvider));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -253,10 +253,7 @@ public class ExecutingCommandTest {
|
|||
// 设置方法为可访问
|
||||
method.setAccessible(true);
|
||||
|
||||
ExecutingCommand.AsyncExecResultHandler callback = new ExecutingCommand.AsyncExecResultHandler() {
|
||||
@Override
|
||||
public void onCommandResult(String result) {
|
||||
}
|
||||
ExecutingCommand.AsyncExecResultHandler callback = result -> {
|
||||
};
|
||||
|
||||
List<String> result = (List<String>) method.invoke(null, 1, true, callback, cmd);
|
||||
|
|
Loading…
Reference in New Issue