summaryrefslogtreecommitdiffstats
path: root/server/tests/src
diff options
context:
space:
mode:
authorJonatan Kronqvist <jonatan@vaadin.com>2014-04-14 11:26:11 +0300
committerJonatan Kronqvist <jonatan@vaadin.com>2014-04-14 11:28:18 +0300
commit1b5b02f878b6f8a597690ef3609801916be913b0 (patch)
tree05e06285b968dc5179088b14e6aee7da816330f8 /server/tests/src
parentee203f581aead7b234a4b64db9a6006e2887dc47 (diff)
parent51c2e93172b0132ead54573c74117efac29c1cec (diff)
downloadvaadin-framework-1b5b02f878b6f8a597690ef3609801916be913b0.tar.gz
vaadin-framework-1b5b02f878b6f8a597690ef3609801916be913b0.zip
Merge branch '7.2'
51c2e93 Revert "Added ItemSetAddEvent and ItemSetRemoveEvent (#2794)" ee4ae9f Merge from 7.1 to 7.2 Conflicts: scripts/automerge7.sh Change-Id: Ieb61caed4b3b6bbc6d3dc84c02ae8eeed897a144
Diffstat (limited to 'server/tests/src')
-rw-r--r--server/tests/src/com/vaadin/data/util/BeanItemContainerTest.java185
-rw-r--r--server/tests/src/com/vaadin/data/util/TestIndexedContainer.java113
2 files changed, 0 insertions, 298 deletions
diff --git a/server/tests/src/com/vaadin/data/util/BeanItemContainerTest.java b/server/tests/src/com/vaadin/data/util/BeanItemContainerTest.java
index b9633753b4..c7d992dbeb 100644
--- a/server/tests/src/com/vaadin/data/util/BeanItemContainerTest.java
+++ b/server/tests/src/com/vaadin/data/util/BeanItemContainerTest.java
@@ -10,15 +10,8 @@ import java.util.Map;
import junit.framework.Assert;
-import org.easymock.Capture;
-import org.easymock.EasyMock;
-
import com.vaadin.data.Container;
-import com.vaadin.data.Container.Indexed.ItemAddEvent;
-import com.vaadin.data.Container.Indexed.ItemRemoveEvent;
-import com.vaadin.data.Container.ItemSetChangeListener;
import com.vaadin.data.Item;
-import com.vaadin.data.util.filter.Compare;
/**
* Test basic functionality of BeanItemContainer.
@@ -734,182 +727,4 @@ public class BeanItemContainerTest extends AbstractBeanContainerTest {
assertNull(container.getContainerProperty(john, "address.street")
.getValue());
}
-
- public void testItemAddedEvent() {
- BeanItemContainer<Person> container = new BeanItemContainer<Person>(
- Person.class);
- Person bean = new Person("John");
- ItemSetChangeListener addListener = createListenerMockFor(container);
- addListener.containerItemSetChange(EasyMock.isA(ItemAddEvent.class));
- EasyMock.replay(addListener);
-
- container.addItem(bean);
-
- EasyMock.verify(addListener);
- }
-
- public void testItemAddedEvent_AddedItem() {
- BeanItemContainer<Person> container = new BeanItemContainer<Person>(
- Person.class);
- Person bean = new Person("John");
- ItemSetChangeListener addListener = createListenerMockFor(container);
- Capture<ItemAddEvent> capturedEvent = captureAddEvent(addListener);
- EasyMock.replay(addListener);
-
- container.addItem(bean);
-
- assertEquals(bean, capturedEvent.getValue().getFirstItemId());
- }
-
- public void testItemAddedEvent_addItemAt_IndexOfAddedItem() {
- BeanItemContainer<Person> container = new BeanItemContainer<Person>(
- Person.class);
- Person bean = new Person("John");
- container.addItem(bean);
- ItemSetChangeListener addListener = createListenerMockFor(container);
- Capture<ItemAddEvent> capturedEvent = captureAddEvent(addListener);
- EasyMock.replay(addListener);
-
- container.addItemAt(1, new Person(""));
-
- assertEquals(1, capturedEvent.getValue().getFirstIndex());
- }
-
- public void testItemAddedEvent_addItemAfter_IndexOfAddedItem() {
- BeanItemContainer<Person> container = new BeanItemContainer<Person>(
- Person.class);
- Person bean = new Person("John");
- container.addItem(bean);
- ItemSetChangeListener addListener = createListenerMockFor(container);
- Capture<ItemAddEvent> capturedEvent = captureAddEvent(addListener);
- EasyMock.replay(addListener);
-
- container.addItemAfter(bean, new Person(""));
-
- assertEquals(1, capturedEvent.getValue().getFirstIndex());
- }
-
- public void testItemAddedEvent_amountOfAddedItems() {
- BeanItemContainer<Person> container = new BeanItemContainer<Person>(
- Person.class);
- ItemSetChangeListener addListener = createListenerMockFor(container);
- Capture<ItemAddEvent> capturedEvent = captureAddEvent(addListener);
- EasyMock.replay(addListener);
- List<Person> beans = Arrays.asList(new Person("Jack"), new Person(
- "John"));
-
- container.addAll(beans);
-
- assertEquals(2, capturedEvent.getValue().getAddedItemsCount());
- }
-
- public void testItemAddedEvent_someItemsAreFiltered_amountOfAddedItemsIsReducedByAmountOfFilteredItems() {
- BeanItemContainer<Person> container = new BeanItemContainer<Person>(
- Person.class);
- ItemSetChangeListener addListener = createListenerMockFor(container);
- Capture<ItemAddEvent> capturedEvent = captureAddEvent(addListener);
- EasyMock.replay(addListener);
- List<Person> beans = Arrays.asList(new Person("Jack"), new Person(
- "John"));
- container.addFilter(new Compare.Equal("name", "John"));
-
- container.addAll(beans);
-
- assertEquals(1, capturedEvent.getValue().getAddedItemsCount());
- }
-
- public void testItemAddedEvent_someItemsAreFiltered_addedItemIsTheFirstVisibleItem() {
- BeanItemContainer<Person> container = new BeanItemContainer<Person>(
- Person.class);
- Person bean = new Person("John");
- ItemSetChangeListener addListener = createListenerMockFor(container);
- Capture<ItemAddEvent> capturedEvent = captureAddEvent(addListener);
- EasyMock.replay(addListener);
- List<Person> beans = Arrays.asList(new Person("Jack"), bean);
- container.addFilter(new Compare.Equal("name", "John"));
-
- container.addAll(beans);
-
- assertEquals(bean, capturedEvent.getValue().getFirstItemId());
- }
-
- public void testItemRemovedEvent() {
- BeanItemContainer<Person> container = new BeanItemContainer<Person>(
- Person.class);
- Person bean = new Person("John");
- container.addItem(bean);
- ItemSetChangeListener removeListener = createListenerMockFor(container);
- removeListener.containerItemSetChange(EasyMock
- .isA(ItemRemoveEvent.class));
- EasyMock.replay(removeListener);
-
- container.removeItem(bean);
-
- EasyMock.verify(removeListener);
- }
-
- public void testItemRemovedEvent_RemovedItem() {
- BeanItemContainer<Person> container = new BeanItemContainer<Person>(
- Person.class);
- Person bean = new Person("John");
- container.addItem(bean);
- ItemSetChangeListener removeListener = createListenerMockFor(container);
- Capture<ItemRemoveEvent> capturedEvent = captureRemoveEvent(removeListener);
- EasyMock.replay(removeListener);
-
- container.removeItem(bean);
-
- assertEquals(bean, capturedEvent.getValue().getFirstItemId());
- }
-
- public void testItemRemovedEvent_indexOfRemovedItem() {
- BeanItemContainer<Person> container = new BeanItemContainer<Person>(
- Person.class);
- container.addItem(new Person("Jack"));
- Person secondBean = new Person("John");
- container.addItem(secondBean);
- ItemSetChangeListener removeListener = createListenerMockFor(container);
- Capture<ItemRemoveEvent> capturedEvent = captureRemoveEvent(removeListener);
- EasyMock.replay(removeListener);
-
- container.removeItem(secondBean);
-
- assertEquals(1, capturedEvent.getValue().getFirstIndex());
- }
-
- public void testItemRemovedEvent_amountOfRemovedItems() {
- BeanItemContainer<Person> container = new BeanItemContainer<Person>(
- Person.class);
- container.addItem(new Person("Jack"));
- container.addItem(new Person("John"));
- ItemSetChangeListener removeListener = createListenerMockFor(container);
- Capture<ItemRemoveEvent> capturedEvent = captureRemoveEvent(removeListener);
- EasyMock.replay(removeListener);
-
- container.removeAllItems();
-
- assertEquals(2, capturedEvent.getValue().getRemovedItemsCount());
- }
-
- private Capture<ItemAddEvent> captureAddEvent(
- ItemSetChangeListener addListener) {
- Capture<ItemAddEvent> capturedEvent = new Capture<ItemAddEvent>();
- addListener.containerItemSetChange(EasyMock.capture(capturedEvent));
- return capturedEvent;
- }
-
- private Capture<ItemRemoveEvent> captureRemoveEvent(
- ItemSetChangeListener removeListener) {
- Capture<ItemRemoveEvent> capturedEvent = new Capture<ItemRemoveEvent>();
- removeListener.containerItemSetChange(EasyMock.capture(capturedEvent));
- return capturedEvent;
- }
-
- private ItemSetChangeListener createListenerMockFor(
- BeanItemContainer<Person> container) {
- ItemSetChangeListener listener = EasyMock
- .createNiceMock(ItemSetChangeListener.class);
- container.addItemSetChangeListener(listener);
- return listener;
- }
}
diff --git a/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java b/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java
index 5da0bdc8a2..09e5a26c15 100644
--- a/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java
+++ b/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java
@@ -4,12 +4,6 @@ import java.util.List;
import junit.framework.Assert;
-import org.easymock.Capture;
-import org.easymock.EasyMock;
-
-import com.vaadin.data.Container.Indexed.ItemAddEvent;
-import com.vaadin.data.Container.Indexed.ItemRemoveEvent;
-import com.vaadin.data.Container.ItemSetChangeListener;
import com.vaadin.data.Item;
public class TestIndexedContainer extends AbstractInMemoryContainerTest {
@@ -277,113 +271,6 @@ public class TestIndexedContainer extends AbstractInMemoryContainerTest {
counter.assertNone();
}
- public void testItemAddedEvent() {
- IndexedContainer container = new IndexedContainer();
- ItemSetChangeListener addListener = createListenerMockFor(container);
- addListener.containerItemSetChange(EasyMock.isA(ItemAddEvent.class));
- EasyMock.replay(addListener);
-
- container.addItem();
-
- EasyMock.verify(addListener);
- }
-
- public void testItemAddedEvent_AddedItem() {
- IndexedContainer container = new IndexedContainer();
- ItemSetChangeListener addListener = createListenerMockFor(container);
- Capture<ItemAddEvent> capturedEvent = captureAddEvent(addListener);
- EasyMock.replay(addListener);
-
- Object itemId = container.addItem();
-
- assertEquals(itemId, capturedEvent.getValue().getFirstItemId());
- }
-
- public void testItemAddedEvent_IndexOfAddedItem() {
- IndexedContainer container = new IndexedContainer();
- ItemSetChangeListener addListener = createListenerMockFor(container);
- container.addItem();
- Capture<ItemAddEvent> capturedEvent = captureAddEvent(addListener);
- EasyMock.replay(addListener);
-
- container.addItemAt(1);
-
- assertEquals(1, capturedEvent.getValue().getFirstIndex());
- }
-
- public void testItemRemovedEvent() {
- IndexedContainer container = new IndexedContainer();
- Object itemId = container.addItem();
- ItemSetChangeListener removeListener = createListenerMockFor(container);
- removeListener.containerItemSetChange(EasyMock
- .isA(ItemRemoveEvent.class));
- EasyMock.replay(removeListener);
-
- container.removeItem(itemId);
-
- EasyMock.verify(removeListener);
- }
-
- public void testItemRemovedEvent_RemovedItem() {
- IndexedContainer container = new IndexedContainer();
- Object itemId = container.addItem();
- ItemSetChangeListener removeListener = createListenerMockFor(container);
- Capture<ItemRemoveEvent> capturedEvent = captureRemoveEvent(removeListener);
- EasyMock.replay(removeListener);
-
- container.removeItem(itemId);
-
- assertEquals(itemId, capturedEvent.getValue().getFirstItemId());
- }
-
- public void testItemRemovedEvent_indexOfRemovedItem() {
- IndexedContainer container = new IndexedContainer();
- container.addItem();
- Object secondItemId = container.addItem();
- ItemSetChangeListener removeListener = createListenerMockFor(container);
- Capture<ItemRemoveEvent> capturedEvent = captureRemoveEvent(removeListener);
- EasyMock.replay(removeListener);
-
- container.removeItem(secondItemId);
-
- assertEquals(1, capturedEvent.getValue().getFirstIndex());
- }
-
- public void testItemRemovedEvent_amountOfRemovedItems() {
- IndexedContainer container = new IndexedContainer();
- container.addItem();
- container.addItem();
- ItemSetChangeListener removeListener = createListenerMockFor(container);
- Capture<ItemRemoveEvent> capturedEvent = captureRemoveEvent(removeListener);
- EasyMock.replay(removeListener);
-
- container.removeAllItems();
-
- assertEquals(2, capturedEvent.getValue().getRemovedItemsCount());
- }
-
- private Capture<ItemAddEvent> captureAddEvent(
- ItemSetChangeListener addListener) {
- Capture<ItemAddEvent> capturedEvent = new Capture<ItemAddEvent>();
- addListener.containerItemSetChange(EasyMock.capture(capturedEvent));
- return capturedEvent;
- }
-
- private Capture<ItemRemoveEvent> captureRemoveEvent(
- ItemSetChangeListener removeListener) {
- Capture<ItemRemoveEvent> capturedEvent = new Capture<ItemRemoveEvent>();
- removeListener.containerItemSetChange(EasyMock.capture(capturedEvent));
- return capturedEvent;
- }
-
- private ItemSetChangeListener createListenerMockFor(
- IndexedContainer container) {
- ItemSetChangeListener listener = EasyMock
- .createNiceMock(ItemSetChangeListener.class);
- container.addItemSetChangeListener(listener);
- return listener;
- }
-
// Ticket 8028
public void testGetItemIdsRangeIndexOutOfBounds() {
IndexedContainer ic = new IndexedContainer();