### Question:
WebvttDecoder extends SimpleSubtitleDecoder { @Override protected WebvttSubtitle decode(byte[] bytes, int length, boolean reset) throws SubtitleDecoderException { parsableWebvttData.reset(bytes, length); webvttCueBuilder.reset(); definedStyles.clear(); try { WebvttParserUtil.validateWebvttHeaderLine(parsableWebvttData); } catch (ParserException e) { throw new SubtitleDecoderException(e); } while (!TextUtils.isEmpty(parsableWebvttData.readLine())) {} int event; ArrayList<WebvttCue> subtitles = new ArrayList<>(); while ((event = getNextEvent(parsableWebvttData)) != EVENT_END_OF_FILE) { if (event == EVENT_COMMENT) { skipComment(parsableWebvttData); } else if (event == EVENT_STYLE_BLOCK) { if (!subtitles.isEmpty()) { throw new SubtitleDecoderException("A style block was found after the first cue."); } parsableWebvttData.readLine(); WebvttCssStyle styleBlock = cssParser.parseBlock(parsableWebvttData); if (styleBlock != null) { definedStyles.add(styleBlock); } } else if (event == EVENT_CUE) { if (cueParser.parseCue(parsableWebvttData, webvttCueBuilder, definedStyles)) { subtitles.add(webvttCueBuilder.build()); webvttCueBuilder.reset(); } } } return new WebvttSubtitle(subtitles); } WebvttDecoder();   }### Answer:
@Test public void testDecodeEmpty() throws IOException { WebvttDecoder decoder = new WebvttDecoder(); byte[] bytes = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), EMPTY_FILE); try { decoder.decode(bytes, bytes.length, false); fail(); } catch (SubtitleDecoderException expected) { } }