HarddriveStorage implements FileStorage { @Override public File getFile(final String fileName) { if (!File.isValid(fileName)) { LOGGER.warn("{}.getFile(): Invalid file name {}.", name, fileName); return null; } int size = 0; for(final File currentFile: fileList) { size += currentFile.getSize(); if (currentFile.getName().equals(fileName)) { final double seekTime = getSeekTime(size); final double transferTime = getTransferTime(currentFile.getSize()); currentFile.setTransactionTime(seekTime + transferTime); return currentFile; } } return null; } HarddriveStorage(final String name, final long capacity);  HarddriveStorage(final long capacity); @Override int getNumStoredFile(); @Override boolean reserveSpace(int fileSize); @Override double addReservedFile(final File file); @Override boolean hasPotentialAvailableSpace(final int fileSize); @Override boolean hasFile(final String fileName); @Override String getName(); @Override void setLatency(final double latency); @Override double getLatency(); @Override void setMaxTransferRate(final double maxTransferRate); @Override double getMaxTransferRate(); boolean setAvgSeekTime(final double seekTime); boolean setAvgSeekTime(final double seekTime, final ContinuousDistribution gen); double getAvgSeekTime(); @Override File getFile(final String fileName); @Override List<String> getFileNameList(); @Override List<File> getFileList(); @Override double getTransferTime(final String fileName); @Override double getTransferTime(final File file); @Override double getTransferTime(final int fileSize); @Override double addFile(final File file); @Override double addFile(final List<File> list); @Override File deleteFile(final String fileName); @Override double deleteFile(final File file); @Override boolean contains(final String fileName); @Override boolean contains(final File file); @Override boolean renameFile(final File file, final String newName); @Override long getCapacity(); @Override long getAvailableResource(); @Override long getAllocatedResource(); @Override boolean isAmountAvailable(long amountToCheck); @Override boolean isAmountAvailable(double amountToCheck); @Override boolean isFull();  }
@Test public void testGetFileWhenInvalidFile() { final HarddriveStorage instance = createHardDrive(); assertEquals(null, instance.getFile(" ")); assertEquals(null, instance.getFile("")); assertEquals(null, instance.getFile(null)); }