Package org.jostraca.section

Examples of org.jostraca.section.Section


    assertEquals( "", ss1.getSection( "s1").getContent() );
  }


  public void testClearAllSections() {
    Section    s1  = new BasicSection( "s1" );
    Section    s2  = new BasicSection( "s2" );
    SectionSet ss1 = new SectionSet();
    ss1.addSection( s1 );
    ss1.appendToSection( "s1", "1" );
    ss1.appendToSection( "s2", "2" );
    assertTrue( ss1.hasSection( "s1" ) );
View Full Code Here


    assertEquals( "", ss1.getSection( "s2").getContent() );
  }


  public void testGetSection() {
    Section    s1  = new BasicSection( "s1" );
    SectionSet ss1 = new SectionSet();
    ss1.addSection( s1 );
    assertTrue( ss1.hasSection( "s1" ) );
    assertEquals( s1, ss1.getSection( "s1" ) );
    assertEquals( "", ss1.getSection( "s2" ).getContent() );
View Full Code Here

    assertEquals( "", ss1.getSection( "s2" ).getContent() );
  }


  public void isEmptySection() {
    Section    s1  = new BasicSection( "s1" );
    SectionSet ss1 = new SectionSet();
    ss1.addSection( s1 );
    assertTrue( ss1.isEmptySection( "s1" ) );
    ss1.appendToSection( "s1", "a" );
    assertTrue( !ss1.isEmptySection( "s1" ) );
View Full Code Here

    assertTrue( ss1.isEmptySection( "s2" ) );
  }


  public void testEquality() {
    Section s1a = new BasicSection( "s1" ); s1a.setContent( "s1" );
    Section s1b = new BasicSection( "s1" ); s1b.setContent( "s1" );
    assertEquals( s1a, s1b );

    Section s2a = new BasicSection( "s2" ); s2a.setContent( "s2" );
    Section s2b = new BasicSection( "s2" ); s2b.setContent( "s2" );
    assertEquals( s2a, s2b );

    assertTrue( !s1a.equals(s2a) );
    assertTrue( !s1b.equals(s2b) );
View Full Code Here

    String fooname = "fooname";
    String footext = "footext";
    String barname = "barname";
    String bartext = "bartext";
    Section fooin = new BasicSection( fooname );
    fooin.setContent( footext );
    Section barin = new BasicSection( barname );
    barin.setContent( bartext );
    SectionSet foobarin = new SectionSet();
    foobarin.addSection( fooin );
    foobarin.addSection( barin );

    Identity identity = new Identity();
   
    Section fooout = identity.modify( fooin, mps );
    assertTrue( fooout.getContent().equals( footext ) );
    assertTrue( fooout.getName().equals( fooname ) );

    identity.modify( barin, mps );
    assertTrue( barin.getContent().equals( bartext ) );
    assertTrue( barin.getName().equals( barname ) );   

    SectionSet  foobarout   = identity.modify( foobarin, mps );
    Enumeration sectionEnum = foobarout.enumerateSections();
    while( sectionEnum.hasMoreElements() ) {
      Section section = (Section) sectionEnum.nextElement();
      if( fooname.equals( section.getName() ) ) {
        assertTrue( section.getContent().equals( footext ) );
      }
      else if( barname.equals( section.getName() ) ) {
        assertTrue( section.getContent().equals( bartext ) );
      }
      else {
        fail();
      }
    }
View Full Code Here

TOP

Related Classes of org.jostraca.section.Section

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.