/* Last Visit Date = 3 days */
CleanUpOperations ops = new CleanUpOperations(true, 3, false, 0, false, false, false, 0, false, 0, false, false, false);
{
CleanUpModel model = new CleanUpModel(ops, marks);
model.generate(new NullProgressMonitor());
List<CleanUpGroup> tasks = model.getTasks();
/* Assert Empty (except default ops) */
assertEquals(1, tasks.size());
}
bm3.setCreationDate(new Date(System.currentTimeMillis() - 5 * DAY));
{
CleanUpModel model = new CleanUpModel(ops, marks);
model.generate(new NullProgressMonitor());
List<CleanUpGroup> groups = model.getTasks();
/* Assert Filled */
assertEquals(2, groups.size());
List<CleanUpTask> tasks = groups.get(1).getTasks();
assertEquals(1, tasks.size());
assertEquals(true, tasks.get(0) instanceof BookMarkTask);
assertEquals(bm3, ((BookMarkTask) tasks.get(0)).getMark());
}
bm3.setCreationDate(new Date(System.currentTimeMillis() - 2 * DAY));
bm1.setLastVisitDate(new Date(System.currentTimeMillis() - 2 * DAY));
{
CleanUpModel model = new CleanUpModel(ops, marks);
model.generate(new NullProgressMonitor());
List<CleanUpGroup> tasks = model.getTasks();
/* Assert Empty (except default ops) */
assertEquals(1, tasks.size());
}
bm1.setLastVisitDate(new Date(System.currentTimeMillis() - 3 * DAY));
{
CleanUpModel model = new CleanUpModel(ops, marks);
model.generate(new NullProgressMonitor());
List<CleanUpGroup> tasks = model.getTasks();
/* Assert Empty (except default ops) */
assertEquals(1, tasks.size());
}
bm1.setLastVisitDate(new Date(System.currentTimeMillis() - 4 * DAY));
{
CleanUpModel model = new CleanUpModel(ops, marks);
model.generate(new NullProgressMonitor());
List<CleanUpGroup> groups = model.getTasks();
/* Assert Filled */
assertEquals(2, groups.size());
List<CleanUpTask> tasks = groups.get(1).getTasks();
assertEquals(1, tasks.size());
assertEquals(true, tasks.get(0) instanceof BookMarkTask);
assertEquals(bm1, ((BookMarkTask) tasks.get(0)).getMark());
}
bm2.setLastVisitDate(new Date(System.currentTimeMillis() - 40 * DAY));
{
CleanUpModel model = new CleanUpModel(ops, marks);
model.generate(new NullProgressMonitor());
List<CleanUpGroup> groups = model.getTasks();
/* Assert Filled */
assertEquals(2, groups.size());
List<CleanUpTask> tasks = groups.get(1).getTasks();