forked from I2P_Developers/i2p.i2p
I2NP: Fix DI test
This commit is contained in:
@@ -9,17 +9,39 @@ package net.i2p.data.i2np;
|
||||
*/
|
||||
|
||||
import net.i2p.data.DataFormatException;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.data.DataStructure;
|
||||
import net.i2p.data.Hash;
|
||||
import net.i2p.data.StructureTest;
|
||||
import net.i2p.data.TunnelId;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test harness for loading / storing DeliveryInstructions objects
|
||||
*
|
||||
* @author jrandom
|
||||
*/
|
||||
public class DeliveryInstructionsTest extends StructureTest {
|
||||
|
||||
/**
|
||||
* Override because DI doesn't support input/output streams any more
|
||||
*/
|
||||
@Override
|
||||
@Test
|
||||
public void testStructure() throws Exception{
|
||||
DeliveryInstructions orig = (DeliveryInstructions) createDataStructure();
|
||||
byte[] temp = new byte[100];
|
||||
int len = orig.writeBytes(temp, 0);
|
||||
|
||||
DeliveryInstructions ds = (DeliveryInstructions) createStructureToRead();
|
||||
ds.readBytes(temp, 0);
|
||||
byte[] temp2 = new byte[100];
|
||||
int len2 = ds.writeBytes(temp2, 0);
|
||||
assert(len2 == len);
|
||||
assert(DataHelper.eq(temp, 0, temp2, 0, len));
|
||||
}
|
||||
|
||||
public DataStructure createDataStructure() throws DataFormatException {
|
||||
DeliveryInstructions instructions = new DeliveryInstructions();
|
||||
//instructions.setDelayRequested(true);
|
||||
|
Reference in New Issue
Block a user