Bug 127861 [DataBinding] Mark API provisional
tests/org.eclipse.jface.tests.databinding/src/org/eclipse/jface/databinding/UpdatableCollectionTest.java
/*
	 * Test method for 'org.eclipse.jface.databinding.UpdatableCollection.getElements()'
	 */
	public void testGetElementsAndSetElements() {
		TestUpdatableCollection collection = new TestUpdatableCollection();
		String string1 = "string1";
		String string2 = "string2";
		String string3 = "string3";
		String string4 = "string4";
		String string5 = "string5";
		
		collection.addElement(string1, 0);
		collection.addElement(string2, 1);
		
		List elementsToUpdate = new ArrayList();
		elementsToUpdate.add(string3);
		elementsToUpdate.add(string4);
		elementsToUpdate.add(string5);
		
		collection.setElements(elementsToUpdate);
		
		assertEquals("The collection was not updated to the right size.", 3, collection.getSize());
		assertEquals("The wrong element was found in position 0", string3, collection.getElement(0));
		assertEquals("The wrong element was found in position 1", string4, collection.getElement(1));
		assertEquals("The wrong element was found in position 2", string5, collection.getElement(2));
		
		assertNotSame("The all elements list instance should not be the one provided in the set.", elementsToUpdate, collection.getElements());