@@ -27,6 +27,10 @@ public class IndexEditTest {
2727
2828 public IndexEditTest () {
2929 }
30+
31+ EditBlock block (byte [] ar ) {
32+ return new SinglePacketBlock (ar );
33+ }
3034
3135 /**
3236 * Test of del method, of class IndexEdit.
@@ -35,7 +39,7 @@ public IndexEditTest() {
3539 public void testDel_long () {
3640 System .out .println ("del" );
3741 long index = 2L ;
38- IndexEdit instance = new SinglePacketBlock (new byte [] {6 ,5 ,4 ,3 ,2 ,1 });
42+ IndexEdit instance = block (new byte [] {6 ,5 ,4 ,3 ,2 ,1 });
3943 byte expResult = 4 ;
4044 byte result = instance .del (index );
4145 assertEquals (expResult , result );
@@ -49,7 +53,7 @@ public void testDel_long_long() {
4953 System .out .println ("del" );
5054 long index = 2L ;
5155 long size = 3L ;
52- EditBlock instance = new SinglePacketBlock (new byte [] {5 ,6 ,7 ,8 ,9 ,10 });
56+ EditBlock instance = block (new byte [] {5 ,6 ,7 ,8 ,9 ,10 });
5357 instance .del (index , size );
5458 assertEquals (0 , instance .backLength () );
5559 assertEquals (3 , instance .length () );
@@ -65,7 +69,7 @@ public void testDel_long_byteArr() {
6569 System .out .println ("del" );
6670 long index = 1L ;
6771 byte [] buf = new byte [3 ];
68- EditBlock instance = new SinglePacketBlock (new byte [] {5 ,6 ,7 ,8 ,9 ,10 });
72+ EditBlock instance = block (new byte [] {5 ,6 ,7 ,8 ,9 ,10 });
6973 byte [] expResult = new byte [] {6 ,7 ,8 };
7074 EditBlock result = instance .del (index , buf );
7175 assertArrayEquals (expResult , buf );
@@ -82,7 +86,7 @@ public void testDel_4args() {
8286 byte [] buf = new byte [4 ];
8387 int offset = 1 ;
8488 int length = 2 ;
85- EditBlock instance = new SinglePacketBlock (new byte [] {5 ,6 ,7 ,8 ,9 ,10 });
89+ EditBlock instance = block (new byte [] {5 ,6 ,7 ,8 ,9 ,10 });
8690 byte [] expResult = new byte [] {0 ,8 ,9 ,0 };
8791 EditBlock result = instance .del (index , buf , offset , length );
8892 assertEquals (result , instance );
@@ -98,7 +102,7 @@ public void testAdd_long_byte() {
98102 long index = 2L ;
99103 byte src = 11 ;
100104 byte [] exr = new byte [] {5 ,6 ,11 ,7 ,8 ,9 ,10 };
101- EditBlock instance = new SinglePacketBlock (new byte [] {5 ,6 ,7 ,8 ,9 ,10 });
105+ EditBlock instance = block (new byte [] {5 ,6 ,7 ,8 ,9 ,10 });
102106 instance .add (index , src );
103107 assertArrayEquals (exr , instance .toByteArray ());
104108 }
@@ -112,7 +116,7 @@ public void testAdd_long_byteArr() {
112116 long index = 4L ;
113117 byte [] src = new byte [] {0 ,1 ,2 };
114118 byte [] exr = new byte [] {5 ,6 ,7 ,8 ,0 ,1 ,2 ,9 ,10 };
115- EditBlock instance = new SinglePacketBlock (new byte [] {5 ,6 ,7 ,8 ,9 ,10 });
119+ EditBlock instance = block (new byte [] {5 ,6 ,7 ,8 ,9 ,10 });
116120 instance .add (index , src );
117121 assertArrayEquals (exr , instance .toByteArray ());
118122 }
@@ -127,7 +131,7 @@ public void testAdd_4args() {
127131 byte [] src = new byte [] {9 ,8 ,7 ,6 };
128132 int offset = 1 ;
129133 int length = 2 ;
130- EditBlock instance = new SinglePacketBlock (new byte [] {5 ,6 ,7 ,8 ,9 ,10 });
134+ EditBlock instance = block (new byte [] {5 ,6 ,7 ,8 ,9 ,10 });
131135 instance .add (index , src , offset , length );
132136 byte [] exr = new byte [] {5 ,6 ,7 ,8 ,8 ,7 ,9 ,10 };
133137 assertArrayEquals (exr , instance .toByteArray ());
0 commit comments