String readUTF = dataInputImpl.readUTF();
Assert.assertEquals(string, readUTF);
}
public void testAllTypes() {
DataOutput dataOutput = new DataOutputImpl();
boolean b = random.nextBoolean();
dataOutput.writeBoolean(b);
byte[] bytes = new byte[10];
random.nextBytes(bytes);
dataOutput.writeByte(bytes[0]);
dataOutput.writeBytes(bytes);
double d = random.nextDouble();
dataOutput.writeDouble(d);
float f = random.nextFloat();
dataOutput.writeFloat(f);
int i = random.nextInt();
dataOutput.writeInt(i);
long l = random.nextLong();
dataOutput.writeLong(l);
short s = (short) 4;
dataOutput.writeShort(s);
String string = randomUnicodeString();
dataOutput.writeUTF(string);
dataOutput.writeVInt(Math.abs(i));
dataOutput.writeVLong(Math.abs(l));
byte[] data = dataOutput.toByteArray();
DataInput dataInput = new DataInputImpl(data);
Assert.assertEquals(b, dataInput.readBoolean());
Assert.assertEquals(bytes[0], dataInput.readByte());
Assert.assertArrayEquals(bytes, dataInput.readBytes(10));
Assert.assertEquals(d, dataInput.readDouble(), 0.0001);