SGTaskPlanner extends Planner { @Override public void plan() { linkCreateTasks(); linkDeleteTasks(); removeUnnecessaryDeleteRuleTasks(); } SGTaskPlanner(Tasks tasks); @Override void plan();  }
@Test void linkDeleteSGRuleTask() { Tasks tasks = new Tasks(); SecurityGroup adminSG = new SecurityGroup("admin"); adminSG.remoteSecurityGroup = new com.amazonaws.services.ec2.model.SecurityGroup().withGroupId("admin"); SecurityGroup webSG = new SecurityGroup("web"); webSG.remoteSecurityGroup = new com.amazonaws.services.ec2.model.SecurityGroup().withGroupId("web") .withIpPermissions(new IpPermission().withUserIdGroupPairs(new UserIdGroupPair().withGroupId("admin"))); DeleteSGTask deleteAdminTask = tasks.add(new DeleteSGTask(adminSG)); DeleteSGTask deleteWebTask = tasks.add(new DeleteSGTask(webSG)); DeleteSGRuleTask deleteWebRuleTask = tasks.add(new DeleteSGRuleTask(webSG, webSG.remoteSecurityGroup.getIpPermissions())); deleteWebTask.dependsOn(deleteWebTask); new SGTaskPlanner(tasks).plan(); assertTrue(deleteAdminTask.dependencies.contains(deleteWebRuleTask)); }