Fix unit test error in ci

This commit is contained in:
KomachiSion 2020-10-21 10:42:50 +08:00
parent cf607a47cd
commit 7ad96444c8
2 changed files with 6 additions and 3 deletions

View File

@ -25,6 +25,8 @@ import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
@ -48,8 +50,9 @@ public class NacosExecuteTaskExecuteEngineTest {
private AbstractExecuteTask task; private AbstractExecuteTask task;
@Test @Test
public void testAddTask() { public void testAddTask() throws InterruptedException {
executeTaskExecuteEngine.addTask("test", task); executeTaskExecuteEngine.addTask("test", task);
TimeUnit.SECONDS.sleep(1);
verify(task).run(); verify(task).run();
assertTrue(executeTaskExecuteEngine.isEmpty()); assertTrue(executeTaskExecuteEngine.isEmpty());
assertEquals(0, executeTaskExecuteEngine.size()); assertEquals(0, executeTaskExecuteEngine.size());

View File

@ -42,7 +42,7 @@ public class HessianSerializer implements Serializer {
@Override @Override
public <T> T deserialize(byte[] data) { public <T> T deserialize(byte[] data) {
return deserialize(data); return deseiralize0(data);
} }
@Override @Override
@ -55,7 +55,7 @@ public class HessianSerializer implements Serializer {
return deserialize(data); return deserialize(data);
} }
private <T> T deseiralize(byte[] data) { private <T> T deseiralize0(byte[] data) {
if (ByteUtils.isEmpty(data)) { if (ByteUtils.isEmpty(data)) {
return null; return null;
} }