@Test public void shouldPositionTheByteBufferBeforeWriting() { InstanceV2 instanceV2 = new InstanceV2(mock(InstanceDomain.class), INSTANCE_NAME, INSTANCE_DOMAIN_ID, mock(PcpString.class)); ByteBuffer byteBuffer = mock(ByteBuffer.class); instanceV2.setOffset(MY_OFFSET); instanceV2.writeToMmv(byteBuffer); InOrder inOrder = Mockito.inOrder(byteBuffer); inOrder.verify(byteBuffer).position(MY_OFFSET); inOrder.verify(byteBuffer).putLong(anyLong()); }
@Override public void writeToMmv(ByteBuffer byteBuffer) { byteBuffer.position(offset); byteBuffer.putLong(instanceDomain.getOffset()); byteBuffer.putInt(0); byteBuffer.putInt(id); byteBuffer.putLong(getStringOffset(nameAsString)); }
InstanceV2 extends Instance { @Override public void writeToMmv(ByteBuffer byteBuffer) { byteBuffer.position(offset); byteBuffer.putLong(instanceDomain.getOffset()); byteBuffer.putInt(0); byteBuffer.putInt(id); byteBuffer.putLong(getStringOffset(nameAsString)); } }
InstanceV2 extends Instance { @Override public void writeToMmv(ByteBuffer byteBuffer) { byteBuffer.position(offset); byteBuffer.putLong(instanceDomain.getOffset()); byteBuffer.putInt(0); byteBuffer.putInt(id); byteBuffer.putLong(getStringOffset(nameAsString)); } InstanceV2(InstanceDomain domain, String name, int id, PcpString nameAsString); }
InstanceV2 extends Instance { @Override public void writeToMmv(ByteBuffer byteBuffer) { byteBuffer.position(offset); byteBuffer.putLong(instanceDomain.getOffset()); byteBuffer.putInt(0); byteBuffer.putInt(id); byteBuffer.putLong(getStringOffset(nameAsString)); } InstanceV2(InstanceDomain domain, String name, int id, PcpString nameAsString); @Override void writeToMmv(ByteBuffer byteBuffer); @Override int byteSize(); }
InstanceV2 extends Instance { @Override public void writeToMmv(ByteBuffer byteBuffer) { byteBuffer.position(offset); byteBuffer.putLong(instanceDomain.getOffset()); byteBuffer.putInt(0); byteBuffer.putInt(id); byteBuffer.putLong(getStringOffset(nameAsString)); } InstanceV2(InstanceDomain domain, String name, int id, PcpString nameAsString); @Override void writeToMmv(ByteBuffer byteBuffer); @Override int byteSize();  }