### Question:
VideoRecordingFileName { public String getByDevice() { log.trace("Lookup device for camera id [{}]", cameraId); Device device = deviceDAO.findById(cameraId); if (device != null) { log.trace("Found device for camera id [{}]", cameraId); String cleanDeviceName = IrisFileName.clean(device.getName(), "_"); if (!StringUtils.isEmpty(cleanDeviceName)) { log.trace("Clean device name is [{}]", cleanDeviceName); Place place = placeDAO.findById(placeId); String dateSuffix = getDateSuffix(place); String fileName = getFileName(cleanDeviceName, dateSuffix); log.trace("Computed file name [{}] for video recording [{}]", fileName, recordingId); if (IrisFileName.isValid(fileName)) { log.trace("File name [{}] is valid for video recording [{}]", fileName, recordingId); return fileName; } } } return ""; } VideoRecordingFileName(
         UUID recordingId,
         UUID cameraId,
         UUID placeId,
         DeviceDAO deviceDAO,
         PlaceDAO placeDAO
         ); String getByDeviceOrDefault(); String getByDevice(); String getFileName(String prefix, String suffix); String getDateSuffix(Place place); String localDateSuffix(Place place, Date date);  }### Answer:
@Test public void getByDevice() throws ParseException { DateFormat utcFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss.SSS"); utcFormat.setTimeZone(TimeZone.getTimeZone("UTC")); Date date = utcFormat.parse("06/01/2015 11:20:04.453"); UUID recordingId = IrisUUID.timeUUID(date); UUID cameraId = IrisUUID.randomUUID(); Place place = Fixtures.createPlace(); place.setTzId("US/Central"); PlaceDAO placeDAO = createNiceMock(PlaceDAO.class); expect(placeDAO.findById(place.getId())).andStubReturn(place); Device camera = Fixtures.createDevice(); camera.setId(cameraId); camera.setName("Cam?Name*With:InvalidChars"); DeviceDAO deviceDAO = createNiceMock(DeviceDAO.class); expect(deviceDAO.findById(cameraId)).andStubReturn(camera); VideoRecordingFileName sut = new VideoRecordingFileName( recordingId, cameraId, place.getId(), deviceDAO, placeDAO); replay(placeDAO); replay(deviceDAO); String result = sut.getByDevice(); Assert.assertEquals("Cam_Name_With_InvalidChars_20150601_062004.mp4", result); }