TodolistActivityGenerator implements ActivityGenerator { @Override public Activity generateCreateActivity(BaseProjectItem item) { Todolist todolist = (Todolist) item; String subject = CREATE_SUBJECT; String type = ActivityActionType.CREATE; if (todolist.getTodos() != null) { subject = COPY_SUBJECT; type = ActivityActionType.COPY; } Activity activity = this.generateActivityByActionType(type, subject, todolist); activity.setContent(todolist.getDescription()); return activity; }  @Override String modelType(); @Override Activity generateCreateActivity(BaseProjectItem item); @Override Activity generateUpdateActivity(BaseProjectItem item, BaseProjectItem modifiedItem); @Override BaseProjectItem enrichModel(BaseProjectItem identifiable); @Override String modelService(); static final String CREATE_SUBJECT; static final String COPY_SUBJECT; static final String UPDATE_SUBJECT; static final String DISCARD_SUBJECT; static final String RECOVER_SUBJECT; static final String MOVE_SUBJECT; static final String RELOCATE_SUBJECT; static final String ARCHIVE_SUBJECT; static final String ACTIVATE_SUBJECT; static final String NAME_UPDATE; static final String DESCRIPTION_UPDATE; static final String NAME_AND_DESCRIPTION_UPDATE; }
@Test public void testGenerateCreateActivity() { Activity ret = todolistActivityGenerator.generateCreateActivity(todolist); assertEquals(ret.getAction(), ActivityActionType.CREATE); assertEquals(ret.getCompanyId(), new Integer(ModuleHelper.companyId)); assertEquals(ret.getProjectId(), new Integer(ModuleHelper.projectId)); ret = todolistActivityGenerator.generateCreateActivity(todolistWithTodos); assertEquals(ret.getAction(), ActivityActionType.COPY); assertEquals(ret.getCompanyId(), new Integer(ModuleHelper.companyId)); assertEquals(ret.getProjectId(), new Integer(ModuleHelper.projectId)); }