@Test
public void testMoveItem()
{

    Dashboard dashboard = new Dashboard();
    
    DashboardItem diA = new DashboardItem();
    DashboardItem diB = new DashboardItem();
    DashboardItem diC = new DashboardItem();
    DashboardItem diD = new DashboardItem();
    
    diA.setUid( "A" );
    diB.setUid( "B" );
    diC.setUid( "C" );
    diD.setUid( "D" );
    
    dashboard.getItems().add( diA );
    dashboard.getItems().add( diB );
    dashboard.getItems().add( diC );
    dashboard.getItems().add( diD );
    
    assertEquals( 4, dashboard.getItems().size() );
    assertEquals( 2, dashboard.getItems().indexOf( diC ) );
    
    assertTrue( dashboard.moveItem( "B", 3 ) ); // Move B up
    assertEquals( 4, dashboard.getItems().size() );
    
    assertEquals( 0, dashboard.getItems().indexOf( diA ) );
    assertEquals( 1, dashboard.getItems().indexOf( diC ) );
    assertEquals( 2, dashboard.getItems().indexOf( diB ) );
    assertEquals( 3, dashboard.getItems().indexOf( diD ) );
    assertTrue( dashboard.moveItem( "C", 4 ) ); // Move C last
    assertEquals( 0, dashboard.getItems().indexOf( diA ) );
    assertEquals( 1, dashboard.getItems().indexOf( diB ) );
    assertEquals( 2, dashboard.getItems().indexOf( diD ) );
    assertEquals( 3, dashboard.getItems().indexOf( diC ) );
    assertTrue( dashboard.moveItem( "D", 1 ) ); // Move D down
    assertEquals( 0, dashboard.getItems().indexOf( diA ) );
    assertEquals( 1, dashboard.getItems().indexOf( diD ) );
    assertEquals( 2, dashboard.getItems().indexOf( diB ) );
    assertEquals( 3, dashboard.getItems().indexOf( diC ) );
    assertTrue( dashboard.moveItem( "C", 0 ) ); // Move C first
    assertEquals( 0, dashboard.getItems().indexOf( diC ) );
    assertEquals( 1, dashboard.getItems().indexOf( diA ) );
    assertEquals( 2, dashboard.getItems().indexOf( diD ) );
    assertEquals( 3, dashboard.getItems().indexOf( diB ) );
    assertFalse( dashboard.moveItem( "C", 5 ) ); // Out of bounds
    assertFalse( dashboard.moveItem( "A", 1 ) ); // Already at position
    assertFalse( dashboard.moveItem( "A", 2 ) ); // Pointless move        
}