FileDocCategorySizeDatePackage
ShifterTest.javaAPI DocGlassfish v2 API4139Fri May 04 22:36:32 BST 2007com.sun.enterprise.admin.jmx.remote.internal

ShifterTest

public class ShifterTest extends TestCase
author
Kedar Mhaswade
since
$Revision: 1.4 $

Fields Summary
Constructors Summary
public ShifterTest(String testName)

		super(testName);
	
Methods Summary
public static voidmain(java.lang.String[] args)

		junit.textui.TestRunner.run(suite());
		//junit.swingui.TestRunner.run(suite());
	
private voidnyi()

		fail("Not yet implemented");
	
protected voidsetUp()

	
public static junit.framework.Testsuite()

		TestSuite suite = new TestSuite(ShifterTest.class);
		return suite;
	
protected voidtearDown()

	
public voidtestCreate()

		final Shifter s = new Shifter(new String[]{"element1"});
	
public voidtestImpossibleLeftShift()

		try {
			final String[] s = new String[]{};
			final Shifter sh = new Shifter(s);
			final Object r = sh.shiftLeft();
			fail("Should have thrown IllegalStateException, but didn't, hence test fails");
		}
		catch(Exception e){}
	
public voidtestRightLeftShiftFromEmpty()

		final Object[] s = new Object[]{};
		final Shifter ss = new Shifter(s);
		ss.shiftRight(new Object());
		ss.shiftLeft();
		assertEquals(ss.state().length, 0);
	
public voidtestShiftLeftOne()

		final String one = "one";
		final String[] s = new String[]{one};
		final Shifter sh = new Shifter(s);
		final Object r = sh.shiftLeft();
		assertEquals(one, r);
	
public voidtestShiftRightFromTwo()

		final Object[] s = new Object[]{new Object(), new Object()};
		final Shifter sh = new Shifter(s);
		final String add = "8";
		sh.shiftRight(add);
		assertEquals(sh.state().length, 3);
	
public voidtestShiftRightOne()

		final String[] s = new String[]{"one"};
		final Shifter sh = new Shifter(s);
		final String add = "8";
		sh.shiftRight(add);
		assertEquals(sh.state().length, 2);
	
public voidtestShiftRightOneFromEmpty()

		final String[] s = new String[]{};
		final Shifter sh = new Shifter(s);
		final String add = "8";
		sh.shiftRight(add);
		assertEquals(sh.state().length, 1);