Package org.jostraca.util

Examples of org.jostraca.util.TextSegmenter.replaceSegment()


  public void testSegment() throws Exception {

    TextSegmenter ts = new TextSegmenter( "foobarbazbeebob", "[", "]" );
    assertTrue( !ts.hasMoreSegments() );
    assertEquals( null, ts.nextSegment() );
    ts.replaceSegment( "X" );
    assertTrue( "foobarbazbeebob".equals( ts.getReplacedContent() ) );

    ts = new TextSegmenter( "foobarbazbeebob", "[", "]" );
    assertTrue( !ts.hasMoreSegments() );
    assertTrue( "foobarbazbeebob".equals( ts.getReplacedContent() ) );
View Full Code Here


    assertTrue( !ts.hasMoreSegments() );

    ts = new TextSegmenter( "foo[bar]baz[bee]bob", "[", "]" );
    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
    ts.replaceSegment( "X" );
    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
    ts.replaceSegment( "Y" );
    assertTrue( !ts.hasMoreSegments() );
    assertEquals( "fooXbazYbob", ts.getReplacedContent() );
View Full Code Here

    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
    ts.replaceSegment( "X" );
    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
    ts.replaceSegment( "Y" );
    assertTrue( !ts.hasMoreSegments() );
    assertEquals( "fooXbazYbob", ts.getReplacedContent() );


    ts = new TextSegmenter( "foo[bar]baz[bee]bob", "[", "]" );
View Full Code Here


    ts = new TextSegmenter( "foo[bar]baz[bee]bob", "[", "]" );
    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
    ts.replaceSegment( "X" );
    ts.replaceSegment( "A" );
    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
    ts.replaceSegment( "Y" );
    assertTrue( !ts.hasMoreSegments() );
View Full Code Here

    ts = new TextSegmenter( "foo[bar]baz[bee]bob", "[", "]" );
    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
    ts.replaceSegment( "X" );
    ts.replaceSegment( "A" );
    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
    ts.replaceSegment( "Y" );
    assertTrue( !ts.hasMoreSegments() );
    assertEquals( "fooAbazYbob", ts.getReplacedContent() );
View Full Code Here

    ts.nextSegment();
    ts.replaceSegment( "X" );
    ts.replaceSegment( "A" );
    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
    ts.replaceSegment( "Y" );
    assertTrue( !ts.hasMoreSegments() );
    assertEquals( "fooAbazYbob", ts.getReplacedContent() );


    ts = new TextSegmenter( "[bar]baz[bee]bob[foo]", "[", "]" );
View Full Code Here


    ts = new TextSegmenter( "[bar]baz[bee]bob[foo]", "[", "]" );
    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
    ts.replaceSegment( "X" );
    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
    ts.replaceSegment( "Y" );
    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
View Full Code Here

    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
    ts.replaceSegment( "X" );
    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
    ts.replaceSegment( "Y" );
    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
    ts.replaceSegment( "Z" );
    assertTrue( !ts.hasMoreSegments() );
    assertEquals( "XbazYbobZ", ts.getReplacedContent() );
View Full Code Here

    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
    ts.replaceSegment( "Y" );
    assertTrue( ts.hasMoreSegments() );
    ts.nextSegment();
    ts.replaceSegment( "Z" );
    assertTrue( !ts.hasMoreSegments() );
    assertEquals( "XbazYbobZ", ts.getReplacedContent() );
    assertEquals( "XbazYbobZ", ts.getReplacedContent() );

  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.