### Question:
FSToPosixTransferClient extends FSToFSTransferClient { @Override public URI transfer(PID binPid, URI sourceFileUri, boolean allowOverwrite) { URI binUri = super.transfer(binPid, sourceFileUri, allowOverwrite); HashedPosixStorageLocation posixLoc = (HashedPosixStorageLocation) destination; if (posixLoc.getPermissions() != null) { Path binPath = Paths.get(binUri); try { Files.setPosixFilePermissions(binPath, posixLoc.getPermissions()); } catch (IOException e) { log.debug("Failed to set permissions in destination {}", destination.getId()); } } return binUri; } FSToPosixTransferClient(IngestSource source, StorageLocation destination); @Override URI transfer(PID binPid, URI sourceFileUri, boolean allowOverwrite);  }### Answer:
@Test public void transfer_NewFile_WithPermissions() throws Exception { when(storageLoc.getPermissions()).thenReturn(new HashSet<>(asList( PosixFilePermission.OWNER_READ, PosixFilePermission.OWNER_WRITE))); Path sourceFile = createSourceFile(); URI binUri = client.transfer(binPid, sourceFile.toUri()); Path binPath = Paths.get(binUri); assertIsSourceFile(binPath); Set<PosixFilePermission> perms = Files.getPosixFilePermissions(binPath); assertEquals(2, perms.size()); assertTrue(perms.contains(PosixFilePermission.OWNER_READ)); assertTrue(perms.contains(PosixFilePermission.OWNER_WRITE)); }