HarddriveStorage implements FileStorage { @Override public boolean hasPotentialAvailableSpace(final int fileSize) { if (fileSize <= 0) { return false; } if (storage.isAmountAvailable((long)fileSize)) { return true; } return getDeletedFilesTotalSize() > fileSize; } 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 testHasPotentialAvailableSpace() { final int fileSize = 100; final HarddriveStorage instance = createHardDrive(); assertTrue(instance.hasPotentialAvailableSpace(fileSize)); assertFalse(instance.hasPotentialAvailableSpace(fileSize*1000)); }
@Test public void testHasPotentialAvailableSpaceWhenInvalidValue() { final HarddriveStorage instance = createHardDrive(); assertFalse(instance.hasPotentialAvailableSpace(0)); assertFalse(instance.hasPotentialAvailableSpace(-1)); }