error handle to all: VlIntException

This commit is contained in:
free will committed 2021-03-18 20:12:27 +08:00
1 parent 96650c8f42
commit 30dd00ffb4
5 files changed
+21 -20

No files matched your search

+6 -6
View File
@@ -16,7 +16,7 @@ import static org.junit.Assert.*;
public class BlockTest {
@Test
public void TestCreateBlockByTypeLengthBuffer() throws VlIntException {
public void TestCreateBlockByTypeLengthBuffer() throws VlIntException, EncoderException {
byte[] buf = new byte[10000];
Block block = Block.createBlockByTypeLengthBuffer(new VlInt(241), new VlInt(8000),ByteHelper.getLenBytes(buf, new VlInt(0),8000),true);
//测试type与size
@@ -42,7 +42,7 @@ public class BlockTest {
//error:block.Size().size()错误。
@Test
public void TestCreateBlockByBuffer() throws VlIntException {
public void TestCreateBlockByBuffer() throws VlIntException, EncoderException {
byte[] buf = new byte[10000];
buf[0] = (byte)212;
buf[1] = (byte)241;
@@ -59,7 +59,7 @@ public class BlockTest {
}
@Test
public void TestBuildByBlock() throws VlIntException {
public void TestBuildByBlock() throws VlIntException, EncoderException {
//Block构造方法测试
byte[] buf = new byte[10000];
Block block1 = Block.createBlockByTypeLengthBuffer(new VlInt(241), new VlInt(8000),ByteHelper.getLenBytes(buf, new VlInt(0),8000),true);
@@ -85,7 +85,7 @@ public class BlockTest {
}
@Test
public void TestBuildByTypeLengthBuffer() throws VlIntException {
public void TestBuildByTypeLengthBuffer() throws VlIntException, EncoderException {
//Block构造方法测试
byte[] buf = new byte[10000];
Block block = new Block(new VlInt(241),new VlInt(8000),ByteHelper.getLenBytes(buf,new VlInt(0),8000),true);
@@ -112,7 +112,7 @@ public class BlockTest {
//error
//TODO 错误处理
@Test
public void TestParseSubElements(){
public void TestParseSubElements() throws EncoderException {
byte[] buf = new byte[10000];
for (int i = 0; i < 240; i++) {
buf[i*8] = (byte)(i+1);
@@ -133,7 +133,7 @@ public class BlockTest {
//error
//TODO 没测完
@Test
public void TestSubElements(){
public void TestSubElements() throws EncoderException {
byte[] buf = new byte[10000];
Block block = new Block();
block.setType(new VlInt(7));
+2 -1
View File
@@ -2,6 +2,7 @@ package others;
import component.CanBePrefix;
import encoding.Block;
import encoding.EncoderException;
import encoding.SelfEncodingBase;
/*
@@ -12,7 +13,7 @@ import encoding.SelfEncodingBase;
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
*/
public class TestCallBack {
public static void main(String[] args){
public static void main(String[] args) throws EncoderException {
CanBePrefix canBePrefix=new CanBePrefix();
Block block=new SelfEncodingBase().selfWireEncode(canBePrefix);
}