### Question:
LogArchiveCache implements Closeable { void add(MessageRecord messageRecord) throws Exception { try { validateMessageRecord(messageRecord); handleRotation(); cacheRecord(messageRecord); updateState(); } catch (Exception e) { handleCacheError(e); } } LogArchiveCache(Supplier<String> randomGenerator,
            LinkingInfoBuilder linkingInfoBuilder,
            Path workingDir); @Override void close();  }### Answer:
@Test public void doNotAllowNullMessageRecords() throws Exception { thrown.expect(IllegalArgumentException.class); cache.add(null); thrown.expectMessage("Message record to be archived must not be null"); }
@Test public void avoidNameClashWhenFileWithSameNameIsAlreadyInSameZip() throws Exception { setMaxArchiveSizeDefault(); cache = createCache(new TestRandomGenerator()); cache.add(createRequestRecordNormal()); assertZip(expectedNormalSizeRequestEntryName(), getArchiveBytes()); cache.add(createRequestRecordNormal()); assertZip(expectedConflictingEntryNames(), getArchiveBytes()); }