FirmwareFileCachingRepository implements CachingRepository<String, byte[]> { @Override public byte[] retrieve(final String key) { return this.cache.get(key); } FirmwareFileCachingRepository(); protected  FirmwareFileCachingRepository(final Map<String, byte[]> cache); @Override boolean isAvailable(final String key); @Override byte[] retrieve(final String key); @Override void store(final String key, final byte[] value);  }
@Test public void retrieveShouldReturnFirmwareFileWhenFirmwareFileInCache() { final byte[] expected = FIRMWARE_FILE; final byte[] actual = this.firmwareFileCachingRepostitory.retrieve(FIRMWARE_IDENTIFICATION); assertThat(actual).isEqualTo(expected); }
@Test public void retrieveShouldReturnNullWhenFirmwareFileNotInCache() { final byte[] actual = this.firmwareFileCachingRepostitory.retrieve(FIRMWARE_IDENTIFICATION_UNAVAILABLE); assertThat(actual).isNull(); }