コード例 #1
0
  @Test
  public void shouldConsume() {
    BlackHoleTokenChannel channel = new BlackHoleTokenChannel("ABC");
    TokenQueue output = mock(TokenQueue.class);
    CodeReader codeReader = new CodeReader("ABCD");

    assertThat(channel.consume(codeReader, output)).isTrue();
    assertThat(codeReader.getLinePosition()).isEqualTo(1);
    assertThat(codeReader.getColumnPosition()).isEqualTo(3);
    verifyZeroInteractions(output);
  }
コード例 #2
0
 @Override
 public boolean consume(CodeReader code, HtmlCodeBuilder codeBuilder) {
   if (code.getColumnPosition() == COLUMN_INDEX && code.popTo(matcher, tmpBuilder) > 0) {
     codeBuilder.appendWithoutTransforming(tagBefore);
     codeBuilder.append(tmpBuilder);
     codeBuilder.appendWithoutTransforming(tagAfter);
     tmpBuilder.delete(0, tmpBuilder.length());
     return true;
   }
   return false;
 }