CameraStreamAdapter extends TypeAdapter<CameraServerData> { public static String videoFilePath(File rootRecordingFile, String cameraName, int fileIndex) { return rootRecordingFile.getAbsolutePath().replace(".sbr", "-" + cameraName + "." + fileIndex + ".mp4"); } 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 testVideoFileName() { assertAll("Video file names", () -> assertEquals( new File("recording-Camera.0.mp4").getAbsolutePath(), videoFilePath(new File("recording.sbr"), "Camera", 0)), () -> assertEquals( new File("foo/bar-a b c.45.mp4").getAbsolutePath(), videoFilePath(new File("foo/bar.sbr"), "a b c", 45) ) ); }