try {
List<Object> tmp = new ArrayList<Object>();
for (int i = 0; i < 100; i++) {
tmp.add(i);
}
new CollectionDataSource(tmp, "test_valid_collection");
} catch (Exception e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
try {
List<Object> tmp = new ArrayList<Object>();
for (int i = 0; i < 100; i++) {
List<Object> inner = new ArrayList<Object>();
inner.add(i);
inner.add('a' + i);
tmp.add(inner);
}
new CollectionDataSource(tmp, "test_valid_double_collection");
} catch (Exception e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
/*
* invalid collection input
*/
try {
List<Object> tmp = new ArrayList<Object>();
for (int i = 0; i < 100; i++) {
tmp.add(i);
}
tmp.add("a");
new CollectionDataSource(tmp, "test_invalid_collection");
Assert.fail("input type is different");
} catch (Exception e) {
}
try {
List<Object> tmp = new ArrayList<Object>();
for (int i = 0; i < 100; i++) {
List<Object> inner = new ArrayList<Object>();
inner.add(i);
inner.add('a' + i);
tmp.add(inner);
}
List<Object> inner = new ArrayList<Object>();
inner.add('a');
inner.add('a');
tmp.add(inner);
new CollectionDataSource(tmp, "test_invalid_double_collection");
Assert.fail("input type is different");
} catch (Exception e) {
}
}