aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/tests/util
diff options
context:
space:
mode:
Diffstat (limited to 'uitest/src/main/java/com/vaadin/tests/util')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java20
1 files changed, 15 insertions, 5 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java b/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java
index cb7c3c28a5..caedc9f299 100644
--- a/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java
+++ b/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java
@@ -1,6 +1,8 @@
package com.vaadin.tests.util;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Random;
import com.vaadin.v7.data.util.BeanItemContainer;
@@ -36,9 +38,18 @@ public class PersonContainer extends BeanItemContainer<Person>
}
public static PersonContainer createWithTestData(int size) {
- PersonContainer c = null;
+ PersonContainer c = new PersonContainer();
+ c.addAll(createTestData(size));
+ return c;
+ }
+
+ public static Collection<Person> createTestData() {
+ return createTestData(100);
+ }
+
+ public static Collection<Person> createTestData(int size) {
Random r = new Random(0);
- c = new PersonContainer();
+ ArrayList<Person> testData = new ArrayList<>();
for (int i = 0; i < size; i++) {
Person p = new Person();
p.setFirstName(TestDataGenerator.getFirstName(r));
@@ -51,10 +62,9 @@ public class PersonContainer extends BeanItemContainer<Person>
p.getAddress().setPostalCode(TestDataGenerator.getPostalCode(r));
p.getAddress()
.setStreetAddress(TestDataGenerator.getStreetAddress(r));
- c.addItem(p);
+ testData.add(p);
}
-
- return c;
+ return testData;
}
}