assertTrue(l.size() > 0);
}
public void test01AddModifyGetAndDelete() throws Exception {
List applications = new ArrayList();
Application application = new Application();
application.setName("test5");
applicationService.save(application,applications);
assertTrue("size must be superior to 0",applications.size() > 0);
File f = new File(XML_PATH+"test5.xml");
assertTrue(f.exists());
String id = "";
for(Iterator it=applications.iterator();it.hasNext();) {
Application a = (Application) it.next();
if("test5".equals(a.getName()))
id=a.getId();
}
Application application2 = new Application("test6");
application2.setId(id);
applicationService.save(application2,applications);
for(Iterator it=applications.iterator();it.hasNext();) {
Application a = (Application) it.next();
if(id.equals(a.getId())) {
assertEquals("name must be equals to test6","test6",a.getName());
break;
}
}
assertNotNull(applicationService.get(id,applications));
Application application3 = new Application("test6");
application3.setId(id);
applicationService.delete(id,applications);
for(Iterator it=applications.iterator();it.hasNext();) {
Application a = (Application) it.next();
if(id.equals(a.getId())) {
fail();
}
}
f = new File(XML_PATH+"test6.xml");
assertFalse(f.exists());