@Test
public void testDuplicatingMultipleFavorites() {
FavoritesEditor editor = new FavoritesEditor();
//add two tasks
FavoriteTask favoriteTask1 = editor.addFavorite(mySubProject1Comple, true);
FavoriteTask favoriteTask2 = editor.addFavorite(mySubSubProjectLib, false);
FavoriteTask favoriteTask3 = editor.addFavorite(mySubSubProjectDoc, false);
//now change the display names and the alwaysShowOutput field, just so we can verify that all fields are copied.
editFavorite(editor, favoriteTask1, "name1", false );
editFavorite(editor, favoriteTask2, "name2", true );
editFavorite(editor, favoriteTask3, "name3", false );
//get the ones to dupicate in a list
List<FavoriteTask> tasksToCopy = new ArrayList<FavoriteTask>();
tasksToCopy.add( favoriteTask1 );
tasksToCopy.add( favoriteTask2 );
//now peform the duplication
editor.duplicateFavorites( tasksToCopy );
//there should be 5 tasks now
Assert.assertEquals( 5, editor.getFavoriteTasks().size() );
//the 4th one (3 from index 0) should be the same as the first one
FavoriteTask favoriteTask4 = editor.getFavoriteTasks().get( 3 );
Assert.assertNotNull( favoriteTask4 );
Assert.assertEquals( favoriteTask1.getFullCommandLine(), favoriteTask4.getFullCommandLine() );
Assert.assertEquals( favoriteTask1.getDisplayName(), favoriteTask4.getDisplayName() );
Assert.assertEquals( favoriteTask1.alwaysShowOutput(), favoriteTask4.alwaysShowOutput() );
//the 5th one (4 from index 0) should be the same as the second one
FavoriteTask favoriteTask5 = editor.getFavoriteTasks().get( 4 );
Assert.assertNotNull(favoriteTask5);
Assert.assertEquals( favoriteTask2.getFullCommandLine(), favoriteTask5.getFullCommandLine() );
Assert.assertEquals( favoriteTask2.getDisplayName(), favoriteTask5.getDisplayName() );
Assert.assertEquals( favoriteTask2.alwaysShowOutput(), favoriteTask5.alwaysShowOutput() );
}