### Question:
HtmlBlock extends SourceBlock { @Override public boolean canStart(LineSequence lineSequence) { Line line = lineSequence.getCurrentLine(); if (line != null) { return startPattern.matcher(line.getText()).matches(); } return false; }  @Override void process(ProcessingContext context, DocumentBuilder builder, LineSequence lineSequence); @Override boolean canStart(LineSequence lineSequence);  }### Answer:
@Test public void canStart() { assertFalse(block.canStart(LineSequence.create(""))); assertTrue(block.canStart(LineSequence.create("<div>"))); assertTrue(block.canStart(LineSequence.create("<table>"))); assertTrue(block.canStart(LineSequence.create("<p>"))); assertFalse(block.canStart(LineSequence.create("<one>"))); assertTrue(block.canStart(LineSequence.create(" <p>"))); assertFalse(block.canStart(LineSequence.create(" <p>"))); assertTrue(block.canStart(LineSequence.create("<p"))); assertTrue(block.canStart(LineSequence.create("<p >"))); assertTrue(block.canStart(LineSequence.create("<p />"))); assertTrue(block.canStart(LineSequence.create("<p/>"))); assertTrue(block.canStart(LineSequence.create("<p\n a=\"b\"\n>"))); }
@Test public void canStartDoesNotAdvanceLineSequencePosition() { LineSequence lineSequence = LineSequence.create("<p\n a=\"b\"\n>"); Line firstLine = lineSequence.getCurrentLine(); assertTrue(block.canStart(lineSequence)); assertSame(firstLine, lineSequence.getCurrentLine()); }