FullSegmentEncryptionKeyCache { @Nullable public byte[] put(Uri uri, byte[] encryptionKey) { return backingMap.put(Assertions.checkNotNull(uri), Assertions.checkNotNull(encryptionKey)); } FullSegmentEncryptionKeyCache(int maxSize); @Nullable byte[] get(@Nullable Uri uri); @Nullable byte[] put(Uri uri, byte[] encryptionKey); boolean containsUri(Uri uri); @Nullable byte[] remove(Uri uri);  }
@Test public void putNullKeyThrowsException() { FullSegmentEncryptionKeyCache cache = new FullSegmentEncryptionKeyCache( 5); try { cache.put(null, encryptionKey); fail(); } catch (NullPointerException expected) { } }
@Test public void putNullValueThrowsException() { FullSegmentEncryptionKeyCache cache = new FullSegmentEncryptionKeyCache( 5); try { cache.put(firstUri, null); fail(); } catch (NullPointerException expected) { } }