Package org.jostraca.util

Examples of org.jostraca.util.SimpleObjectManager


  // public methods

  public void testSetDefaultJavaPackage() {
    ErrorUtil.setQuiet( true );
    SimpleObjectManager som = new SimpleObjectManager( TextualTransform.class );

    som.setDefaultJavaPackage( null );
    assertTrue( som.DEFAULT_JAVA_PACKAGE.equals( som.getDefaultJavaPackage() ) );

    som.setDefaultJavaPackage( Standard.EMPTY );
    assertTrue( Standard.EMPTY.equals( som.getDefaultJavaPackage() ) );

    String foobar = "foo.bar";
    som.setDefaultJavaPackage( foobar );
    assertTrue( (foobar+Standard.DOT).equals( som.getDefaultJavaPackage() ) );

    som.setDefaultJavaPackage( foobar+Standard.DOT );
    assertTrue( (foobar+Standard.DOT).equals( som.getDefaultJavaPackage() ) );
  }
View Full Code Here


  public void testLoad() throws Exception {

    String transformPackage = "org.jostraca.transform.";

    SimpleObjectManager som = new SimpleObjectManager( TextualTransform.class, transformPackage );
    String              classes;

    classes = "JavaStringEscapeTransform";
    som.loadClasses( classes );
    assertEquals( (TextualTransform.class.getName()+": "+transformPackage+classes), som.toString() );

    // and again - should be the same
    som.loadClasses( classes );
    assertEquals( (TextualTransform.class.getName()+": "+transformPackage+classes), som.toString() );

    classes = "org.jostraca.transform.JavaStringEscapeTransform";
    som.loadClasses( classes );
    assertTrue( (TextualTransform.class.getName()+": "+classes).equals( som.toString() ) );

    classes = "JavaStringEscapeTransform, HTMLEscapeTransform";
    som.loadClasses( classes );
    assertTrue( (TextualTransform.class.getName()+": "+(transformPackage+"JavaStringEscapeTransform"
                                                        +", "+transformPackage+"HTMLEscapeTransform"))
                .equals( som.toString() ) );

    classes = Standard.EMPTY;
    som.loadClasses( classes );
    assertEquals( (TextualTransform.class.getName()+": "+Standard.EMPTY), som.toString() );
  }
View Full Code Here

    assertEquals( (TextualTransform.class.getName()+": "+Standard.EMPTY), som.toString() );
  }


  public void testPrependAppendRemove() throws Exception {
    SimpleObjectManager som = new SimpleObjectManager( TextualTransform.class );

    TrimTransform tt = new TrimTransform();
    som.prepend( tt );
    assertTrue( (TextualTransform.class.getName()+": "+tt.getClass().getName()).equals( som.toString() ) );

    try {
      som.prepend( new Object() );
      fail();
    } catch( Exception e ) {}

    CropTransform ct = new CropTransform();
    som.prepend( ct );
    assertTrue( (TextualTransform.class.getName()+": "+ct.getClass().getName()+", "+tt.getClass().getName())
            .equals( som.toString() ) );

    JavaStringEscapeTransform jset = new JavaStringEscapeTransform();
    som.append( jset );
    assertTrue( (TextualTransform.class.getName()+": "+ct.getClass().getName()+", "+tt.getClass().getName()+", "+jset.getClass().getName())
            .equals( som.toString() ) );


    som.remove( tt );
    assertTrue( (TextualTransform.class.getName()+": "+ct.getClass().getName()+", "+jset.getClass().getName())
            .equals( som.toString() ) );
   
  }
View Full Code Here

TOP

Related Classes of org.jostraca.util.SimpleObjectManager

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.