ArrayList<Gesture> prototypes = new ArrayList<Gesture>();
for (int i = 0; i < 5; i++) {
Gesture g = new Gesture("test" + i, new ArrayList<PointR>());
prototypes.add(g);
}
Category c = null;
try {
c = new Category("test", prototypes);
}
catch (Exception e1) {
fail("exception in initialising a category with prototypes");
}
try {
c.addExample(new Gesture("test5", null));
}
catch (Exception e) {
if (e.getMessage().indexOf("Prototype name") != -1) {
return;
}
else
fail("error in adding examples." + e.getMessage());
}
if (c.getExamples() != 6) {
fail("error in adding examples");
}
try {
c.addExample(new Gesture("test5", null));
}
catch (Exception e) {
if (e.getMessage().indexOf("Prototype name") != -1) {
return;
}
else
fail("error in adding examples." + e.getMessage());
}
if (c.getExamples() != 6) {
fail("error in adding examples");
}
}