CameraStreamAdapter extends TypeAdapter<CameraServerData> { @Override public int getSerializedSize(CameraServerData value) { return value.getName().length() + SIZE_OF_INT + SIZE_OF_BYTE + SIZE_OF_SHORT + SIZE_OF_INT + SIZE_OF_SHORT; } CameraStreamAdapter(); @Override void flush(); @Override void cleanUp(); @Override CameraServerData deserialize(byte[] buffer, int bufferPosition); @Override int getSerializedSize(CameraServerData value); @Override byte[] serialize(CameraServerData data); static String videoFilePath(File rootRecordingFile, String cameraName, int fileIndex);  }
@Test public void testSerializedSize() { CameraServerData data = new CameraServerData("name", null, 0, 0); assertEquals(4 + 4 + 1 + 2 + 4 + 2, adapter.getSerializedSize(data)); }