HarddriveStorage implements FileStorage { @Override public void setLatency(final double latency) { if (latency < 0) { throw new IllegalArgumentException("Latency must be greater than zero."); } this.latency = latency; } 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 testSetLatencyNegative() { final HarddriveStorage instance = createHardDrive(); Assertions.assertThrows(IllegalArgumentException.class, () -> instance.setLatency(-1)); }