Package org.sonar.plugins.core.issue.tracking

Examples of org.sonar.plugins.core.issue.tracking.StringText


  private final HashedSequence<StringText> b;
  private final HashedSequenceComparator<StringText> cmp;

  @VisibleForTesting
  public IssueTrackingBlocksRecognizer(String referenceSource, String source) {
    this.a = HashedSequence.wrap(new StringText(referenceSource), StringTextComparator.IGNORE_WHITESPACE);
    this.b = HashedSequence.wrap(new StringText(source), StringTextComparator.IGNORE_WHITESPACE);
    this.cmp = new HashedSequenceComparator<StringText>(StringTextComparator.IGNORE_WHITESPACE);
  }
View Full Code Here


    this.lastSnapshots = lastSnapshots;
    this.resource = resource;
  }

  private void initHashes() {
    hashedReference = HashedSequence.wrap(new StringText(getReferenceSource()), StringTextComparator.IGNORE_WHITESPACE);
    hashedSource = HashedSequence.wrap(new StringText(getSource()), StringTextComparator.IGNORE_WHITESPACE);
  }
View Full Code Here

public class StringTextTest {

  @Test
  public void testEmpty() {
    StringText r = new StringText("");
    assertThat(r.length()).isEqualTo(0);
  }
View Full Code Here

    assertThat(r.length()).isEqualTo(0);
  }

  @Test
  public void testTwoLines() {
    StringText r = new StringText("a\nb");
    assertThat(r.length()).isEqualTo(2);
  }
View Full Code Here

public class RollingHashSequenceTest {

  @Test
  public void test_hash() {
    StringText seq = new StringText("line0 \n line1 \n line2");
    StringTextComparator cmp = StringTextComparator.IGNORE_WHITESPACE;
    RollingHashSequence<StringText> seq2 = RollingHashSequence.wrap(seq, cmp, 1);
    RollingHashSequenceComparator<StringText> cmp2 = new RollingHashSequenceComparator<StringText>(cmp);

    assertThat(seq2.length()).isEqualTo(3);
View Full Code Here

  }

  @Test
  public void test_equals() {
    StringTextComparator baseCmp = StringTextComparator.IGNORE_WHITESPACE;
    RollingHashSequence<StringText> a = RollingHashSequence.wrap(new StringText("line0 \n line1 \n line2"), baseCmp, 1);
    RollingHashSequence<StringText> b = RollingHashSequence.wrap(new StringText("line0 \n line1 \n line2 \n line3"), baseCmp, 1);
    RollingHashSequenceComparator<StringText> cmp = new RollingHashSequenceComparator<StringText>(baseCmp);

    assertThat(cmp.equals(a, 0, b, 0)).isTrue();
    assertThat(cmp.equals(a, 1, b, 1)).isTrue();
    assertThat(cmp.equals(a, 2, b, 2)).isFalse();
View Full Code Here

  @Test
  public void testEquals() {
    StringTextComparator cmp = StringTextComparator.IGNORE_WHITESPACE;

    StringText a = new StringText("abc\nabc\na bc");
    StringText b = new StringText("abc\nabc d\nab c");

    assertThat(cmp.equals(a, 0, b, 0)).as("abc == abc").isTrue();
    assertThat(cmp.equals(a, 1, b, 1)).as("abc != abc d").isFalse();
    assertThat(cmp.equals(a, 2, b, 2)).as("a bc == ab c").isTrue();
    assertThat(cmp.hash(a, 0)).isEqualTo(cmp.hash(b, 0));
View Full Code Here

TOP

Related Classes of org.sonar.plugins.core.issue.tracking.StringText

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.