### Question:
IcyDecoder implements MetadataDecoder { @Override @Nullable @SuppressWarnings("ByteBufferBackingArray") public Metadata decode(MetadataInputBuffer inputBuffer) { ByteBuffer buffer = inputBuffer.data; byte[] data = buffer.array(); int length = buffer.limit(); return decode(Util.fromUtf8Bytes(data, 0, length)); }  @Override @Nullable @SuppressWarnings("ByteBufferBackingArray") Metadata decode(MetadataInputBuffer inputBuffer);  }### Answer:
@Test public void decode() { IcyDecoder decoder = new IcyDecoder(); Metadata metadata = decoder.decode("StreamTitle='test title';StreamURL='test_url';"); assertThat(metadata.length()).isEqualTo(1); IcyInfo streamInfo = (IcyInfo) metadata.get(0); assertThat(streamInfo.title).isEqualTo("test title"); assertThat(streamInfo.url).isEqualTo("test_url"); }
@Test public void decode_titleOnly() { IcyDecoder decoder = new IcyDecoder(); Metadata metadata = decoder.decode("StreamTitle='test title';"); assertThat(metadata.length()).isEqualTo(1); IcyInfo streamInfo = (IcyInfo) metadata.get(0); assertThat(streamInfo.title).isEqualTo("test title"); assertThat(streamInfo.url).isNull(); }
@Test public void decode_semiColonInTitle() { IcyDecoder decoder = new IcyDecoder(); Metadata metadata = decoder.decode("StreamTitle='test; title';StreamURL='test_url';"); assertThat(metadata.length()).isEqualTo(1); IcyInfo streamInfo = (IcyInfo) metadata.get(0); assertThat(streamInfo.title).isEqualTo("test; title"); assertThat(streamInfo.url).isEqualTo("test_url"); }
@Test public void decode_quoteInTitle() { IcyDecoder decoder = new IcyDecoder(); Metadata metadata = decoder.decode("StreamTitle='test' title';StreamURL='test_url';"); assertThat(metadata.length()).isEqualTo(1); IcyInfo streamInfo = (IcyInfo) metadata.get(0); assertThat(streamInfo.title).isEqualTo("test' title"); assertThat(streamInfo.url).isEqualTo("test_url"); }
@Test public void decode_notIcy() { IcyDecoder decoder = new IcyDecoder(); Metadata metadata = decoder.decode("NotIcyData"); assertThat(metadata).isNull(); }