/*
* Name: BlockTest
* Authors: Richard Rodger
* Release: 0.3
*
* Copyright (c) 2001-2003 Richard Rodger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
// package
package org.jostraca.test;
/* Import << */
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
import org.jostraca.Block;
/* Import >> */
/** <b>Description:</b><br>
* Test cases for org.jostraca.Block
*/
public class BlockTest extends TestCase {
public BlockTest( String pName ) {
super( pName );
}
public static TestSuite suite() {
return new TestSuite( BlockTest.class );
}
public static void main( String[] pArgs ) {
TestRunner.run( suite() );
}
public void testContent() {
String c1 = "c1";
Block b1 = new Block( Block.TYPE_text, c1 );
assertTrue( c1.equals( b1.getContent() ) );
String c2 = "c2";
Block b2 = new Block( Block.TYPE_script, c2 );
assertTrue( c2.equals( b2.getContent() ) );
}
public void testTypeAndEquals() {
String c1 = "c1";
Block b1 = new Block( Block.TYPE_text, c1 );
assertTrue( b1.isText() );
assertTrue( !b1.isScript() );
assertTrue( Block.TYPE_text == b1.getType() );
Block b1e = new Block( Block.TYPE_text, c1 );
assertEquals( b1, b1e );
String c2 = "c2";
Block b2 = new Block( Block.TYPE_script, c2 );
assertTrue( b2.isScript() );
assertTrue( !b2.isText() );
assertTrue( Block.TYPE_script == b2.getType() );
Block b2e = new Block( Block.TYPE_script, c2 );
assertEquals( b2, b2e );
assertTrue( !b1.equals( b2 ) );
}
}