1
2
3
4
5 package org.kuali.student.enrollment.class2.courseofferingset.service.impl;
6
7 import java.util.ArrayList;
8 import java.util.Arrays;
9 import java.util.Collections;
10 import java.util.List;
11 import javax.annotation.Resource;
12 import org.junit.Before;
13 import org.junit.Test;
14 import static org.junit.Assert.*;
15 import org.junit.runner.RunWith;
16 import org.kuali.student.enrollment.acal.dto.TermInfo;
17 import org.kuali.student.enrollment.acal.service.AcademicCalendarService;
18 import org.kuali.student.enrollment.class2.courseoffering.service.impl.AcalTestDataLoader;
19 import org.kuali.student.enrollment.class2.courseoffering.service.impl.CourseR1TestDataLoader;
20 import org.kuali.student.enrollment.courseoffering.dto.ActivityOfferingInfo;
21 import org.kuali.student.enrollment.courseoffering.dto.CourseOfferingInfo;
22 import org.kuali.student.enrollment.courseoffering.dto.FormatOfferingInfo;
23 import org.kuali.student.enrollment.courseoffering.service.CourseOfferingService;
24 import org.kuali.student.enrollment.courseofferingset.dto.SocInfo;
25 import org.kuali.student.enrollment.courseofferingset.dto.SocRolloverResultInfo;
26 import org.kuali.student.enrollment.courseofferingset.dto.SocRolloverResultItemInfo;
27 import org.kuali.student.enrollment.courseofferingset.service.CourseOfferingSetService;
28 import org.kuali.student.r2.common.util.ContextUtils;
29 import org.kuali.student.r2.lum.course.dto.ActivityInfo;
30 import org.kuali.student.r2.lum.course.dto.CourseInfo;
31 import org.kuali.student.r2.lum.course.dto.FormatInfo;
32 import org.kuali.student.r2.lum.course.service.CourseService;
33 import org.kuali.student.r2.common.dto.ContextInfo;
34 import org.kuali.student.r2.common.exceptions.AlreadyExistsException;
35 import org.kuali.student.r2.common.exceptions.DataValidationErrorException;
36 import org.kuali.student.r2.common.exceptions.DependentObjectsExistException;
37 import org.kuali.student.r2.common.exceptions.DoesNotExistException;
38 import org.kuali.student.r2.common.exceptions.InvalidParameterException;
39 import org.kuali.student.r2.common.exceptions.MissingParameterException;
40 import org.kuali.student.r2.common.exceptions.OperationFailedException;
41 import org.kuali.student.r2.common.exceptions.PermissionDeniedException;
42 import org.kuali.student.r2.common.exceptions.ReadOnlyException;
43 import org.kuali.student.r2.common.exceptions.VersionMismatchException;
44 import org.kuali.student.r2.common.util.RichTextHelper;
45 import org.kuali.student.r2.core.constants.AtpServiceConstants;
46 import org.kuali.student.r2.common.util.constants.CourseOfferingSetServiceConstants;
47 import org.kuali.student.r2.common.util.constants.LuServiceConstants;
48 import org.kuali.student.r2.common.util.constants.LuiServiceConstants;
49 import org.springframework.test.context.ContextConfiguration;
50 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
51
52
53
54
55
56
57 @RunWith(SpringJUnit4ClassRunner.class)
58 @ContextConfiguration(locations = {"classpath:soc-businesslogic-with-mocks-test-context.xml"})
59 public class TestCourseOfferingSetServiceBusinessLogicWithMocks {
60
61 @Resource(name = "socService")
62 protected CourseOfferingSetService socService;
63 @Resource(name = "coService")
64 protected CourseOfferingService coService;
65 public static String principalId = "123";
66 public ContextInfo callContext = null;
67 @Resource(name = "courseService")
68 protected CourseService courseService;
69 @Resource(name = "acalService")
70 protected AcademicCalendarService acalService;
71
72 @Before
73 public void setUp() {
74 callContext = new ContextInfo();
75 callContext.setPrincipalId(principalId);
76
77
78
79
80
81
82
83 }
84
85 @Test
86 public void testRollover() throws DoesNotExistException,
87 DataValidationErrorException, InvalidParameterException, MissingParameterException,
88 OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException,
89 DependentObjectsExistException, AlreadyExistsException, InterruptedException {
90 assertNotNull(callContext);
91 AcalTestDataLoader acalLoader = new AcalTestDataLoader(this.acalService);
92 acalLoader.loadTerm("2011SP", "Spring 2011", "Spring Term 2011", AtpServiceConstants.ATP_SPRING_TYPE_KEY,
93 "2011-03-01 00:00:00.0", "2011-05-31 00:00:00.0");
94 acalLoader.loadTerm("2011FA", "Fall 2011", "Fall Term 2011", AtpServiceConstants.ATP_FALL_TYPE_KEY,
95 "2011-09-01 00:00:00.0", "2011-12-31 00:00:00.0");
96 acalLoader.loadTerm("2012SP", "Spring 2012", "Spring Term 2012", AtpServiceConstants.ATP_SPRING_TYPE_KEY,
97 "2012-03-01 00:00:00.0", "2012-05-31 00:00:00.0");
98 acalLoader.loadTerm("2012FA", "Fall 2012", "Fall Term 2012", AtpServiceConstants.ATP_FALL_TYPE_KEY,
99 "2012-09-01 00:00:00.0", "2012-12-31 00:00:00.0");
100 acalLoader.loadTerm("2013SP", "Spring 2013", "Spring Term 2013", AtpServiceConstants.ATP_SPRING_TYPE_KEY,
101 "2013-03-01 00:00:00.0", "2013-05-31 00:00:00.0");
102
103 CourseR1TestDataLoader courseLoader = new CourseR1TestDataLoader(this.courseService);
104 courseLoader.loadCourse("COURSE1", "2012FA", "CHEM", "CHEM123", "Chemistry 123", "description 1", "COURSE1-FORMAT1",
105 LuServiceConstants.COURSE_ACTIVITY_LECTURE_TYPE_KEY, LuServiceConstants.COURSE_ACTIVITY_LAB_TYPE_KEY);
106 courseLoader.loadCourse("COURSE2", "2012SP", "ENG", "ENG101", "Intro English", "description 2", "COURSE2-FORMAT1",
107 LuServiceConstants.COURSE_ACTIVITY_LECTURE_TYPE_KEY, null);
108
109
110 TermInfo sourceTerm = acalService.getTerm("2012FA", callContext);
111
112 List<String> optionKeys = new ArrayList<String>();
113 CourseInfo course1;
114 try {
115 course1 = courseService.getCourse("COURSE1", ContextUtils.getContextInfo());
116 } catch (Exception ex) {
117 throw new RuntimeException(ex);
118 }
119 CourseOfferingInfo sourceCo1 = new CourseOfferingInfo();
120 sourceCo1.setCourseId(course1.getId());
121 sourceCo1.setTermId(sourceTerm.getId());
122 sourceCo1.setTypeKey(LuiServiceConstants.COURSE_OFFERING_TYPE_KEY);
123 sourceCo1.setStateKey(LuiServiceConstants.LUI_CO_STATE_OFFERED_KEY);
124 sourceCo1 = coService.createCourseOffering(sourceCo1.getCourseId(), sourceCo1.getTermId(),
125 sourceCo1.getTypeKey(), sourceCo1, optionKeys, callContext);
126
127 FormatInfo format1 = course1.getFormats().get(0);
128 FormatOfferingInfo sourceFo1 = new FormatOfferingInfo();
129 sourceFo1.setTypeKey(LuiServiceConstants.FORMAT_OFFERING_TYPE_KEY);
130 sourceFo1.setStateKey(LuiServiceConstants.LUI_FO_STATE_OFFERED_KEY);
131 sourceFo1.setCourseOfferingId(sourceCo1.getId());
132 sourceFo1.setDescr(new RichTextHelper().fromPlain("test format offering"));
133 sourceFo1.setFormatId(format1.getId());
134 sourceFo1.setName("format offering 1");
135 sourceFo1.setTermId(sourceCo1.getTermId());
136 sourceFo1 = coService.createFormatOffering(sourceFo1.getCourseOfferingId(), sourceFo1.getFormatId(),
137 sourceFo1.getTypeKey(), sourceFo1, callContext);
138
139 ActivityInfo activity1 = format1.getActivities().get(0);
140 ActivityOfferingInfo sourceAo1A = new ActivityOfferingInfo();
141 sourceAo1A.setFormatOfferingId(sourceFo1.getId());
142 sourceAo1A.setActivityId(activity1.getId());
143 sourceAo1A.setTypeKey(LuiServiceConstants.LECTURE_ACTIVITY_OFFERING_TYPE_KEY);
144 sourceAo1A.setStateKey(LuiServiceConstants.LUI_AO_STATE_OFFERED_KEY);
145 sourceAo1A.setActivityCode("A");
146 sourceAo1A.setDescr(new RichTextHelper().fromPlain("test activity"));
147 sourceAo1A.setIsHonorsOffering(Boolean.TRUE);
148 sourceAo1A.setMaximumEnrollment(100);
149 sourceAo1A.setMinimumEnrollment(90);
150 sourceAo1A.setName("my activity offering");
151 sourceAo1A = coService.createActivityOffering(sourceAo1A.getFormatOfferingId(), sourceAo1A.getActivityId(),
152 sourceAo1A.getTypeKey(), sourceAo1A, callContext);
153
154 ActivityOfferingInfo sourceAo1B = new ActivityOfferingInfo();
155 sourceAo1B.setFormatOfferingId(sourceFo1.getId());
156 sourceAo1B.setActivityId(activity1.getId());
157 sourceAo1B.setTypeKey(LuiServiceConstants.LECTURE_ACTIVITY_OFFERING_TYPE_KEY);
158 sourceAo1B.setStateKey(LuiServiceConstants.LUI_AO_STATE_OFFERED_KEY);
159 sourceAo1B.setActivityCode("B");
160 sourceAo1B.setDescr(new RichTextHelper().fromPlain("test activity B"));
161 sourceAo1B.setIsHonorsOffering(Boolean.TRUE);
162 sourceAo1B.setMaximumEnrollment(100);
163 sourceAo1B.setMinimumEnrollment(90);
164 sourceAo1B.setName("my B activity offering");
165 sourceAo1B = coService.createActivityOffering(sourceAo1B.getFormatOfferingId(), sourceAo1B.getActivityId(),
166 sourceAo1B.getTypeKey(), sourceAo1B, callContext);
167
168
169 CourseInfo course2;
170 try {
171 course2 = courseService.getCourse("COURSE2", ContextUtils.getContextInfo());
172 } catch (Exception ex) {
173 throw new RuntimeException(ex);
174 }
175 CourseOfferingInfo sourceCo2 = new CourseOfferingInfo();
176 sourceCo2.setCourseId(course2.getId());
177 sourceCo2.setTermId(sourceTerm.getId());
178 sourceCo2.setTypeKey(LuiServiceConstants.COURSE_OFFERING_TYPE_KEY);
179 sourceCo2.setStateKey(LuiServiceConstants.LUI_CO_STATE_OFFERED_KEY);
180 sourceCo2 = coService.createCourseOffering(sourceCo2.getCourseId(), sourceCo2.getTermId(),
181 sourceCo2.getTypeKey(), sourceCo2, optionKeys, callContext);
182
183 FormatInfo format2 = course2.getFormats().get(0);
184 FormatOfferingInfo sourceFo2 = new FormatOfferingInfo();
185 sourceFo2.setTypeKey(LuiServiceConstants.FORMAT_OFFERING_TYPE_KEY);
186 sourceFo2.setStateKey(LuiServiceConstants.LUI_FO_STATE_OFFERED_KEY);
187 sourceFo2.setCourseOfferingId(sourceCo2.getId());
188 sourceFo2.setDescr(new RichTextHelper().fromPlain("test format offering"));
189 sourceFo2.setFormatId(format2.getId());
190 sourceFo2.setName("format offering 1");
191 sourceFo2.setTermId(sourceCo2.getTermId());
192 sourceFo2 = coService.createFormatOffering(sourceFo2.getCourseOfferingId(), sourceFo2.getFormatId(),
193 sourceFo2.getTypeKey(), sourceFo2, callContext);
194
195 ActivityInfo activity2 = format2.getActivities().get(0);
196 ActivityOfferingInfo sourceAo2A = new ActivityOfferingInfo();
197 sourceAo2A.setFormatOfferingId(sourceFo2.getId());
198 sourceAo2A.setActivityId(activity2.getId());
199 sourceAo2A.setTypeKey(LuiServiceConstants.LECTURE_ACTIVITY_OFFERING_TYPE_KEY);
200 sourceAo2A.setStateKey(LuiServiceConstants.LUI_AO_STATE_OFFERED_KEY);
201 sourceAo2A.setActivityCode("A");
202 sourceAo2A.setDescr(new RichTextHelper().fromPlain("test activity"));
203 sourceAo2A.setIsHonorsOffering(Boolean.TRUE);
204 sourceAo2A.setMaximumEnrollment(100);
205 sourceAo2A.setMinimumEnrollment(90);
206 sourceAo2A.setName("my activity offering");
207 sourceAo2A = coService.createActivityOffering(sourceAo2A.getFormatOfferingId(), sourceAo2A.getActivityId(),
208 sourceAo2A.getTypeKey(), sourceAo2A, callContext);
209
210 ActivityOfferingInfo sourceAo2B = new ActivityOfferingInfo();
211 sourceAo2B.setFormatOfferingId(sourceFo2.getId());
212 sourceAo2B.setActivityId(activity2.getId());
213 sourceAo2B.setTypeKey(LuiServiceConstants.LECTURE_ACTIVITY_OFFERING_TYPE_KEY);
214 sourceAo2B.setStateKey(LuiServiceConstants.LUI_AO_STATE_OFFERED_KEY);
215 sourceAo2B.setActivityCode("B");
216 sourceAo2B.setDescr(new RichTextHelper().fromPlain("test activity B"));
217 sourceAo2B.setIsHonorsOffering(Boolean.TRUE);
218 sourceAo2B.setMaximumEnrollment(100);
219 sourceAo2B.setMinimumEnrollment(90);
220 sourceAo2B.setName("my B activity offering");
221 sourceAo2B = coService.createActivityOffering(sourceAo2B.getFormatOfferingId(), sourceAo2B.getActivityId(),
222 sourceAo2B.getTypeKey(), sourceAo2B, callContext);
223
224
225 SocInfo sourceSoc = new SocInfo();
226 sourceSoc.setTypeKey(CourseOfferingSetServiceConstants.MAIN_SOC_TYPE_KEY);
227 sourceSoc.setStateKey(CourseOfferingSetServiceConstants.DRAFT_SOC_STATE_KEY);
228 sourceSoc.setTermId(sourceTerm.getId());
229 sourceSoc = socService.createSoc(sourceSoc.getTermId(), sourceSoc.getTypeKey(), sourceSoc, callContext);
230
231
232 TermInfo targetTerm = acalService.getTerm("2013SP", callContext);
233 optionKeys = buildRolloverOptionKeys();
234
235 SocInfo targetSoc = getTargetSocAfterRollover(sourceSoc.getId(), targetTerm.getId(), optionKeys, callContext);
236 assertNotNull(targetSoc);
237 assertEquals(targetTerm.getId(), targetSoc.getTermId());
238 assertEquals(sourceSoc.getStateKey(), targetSoc.getStateKey());
239 assertEquals(sourceSoc.getTypeKey(), targetSoc.getTypeKey());
240
241 List<String> resultIds = socService.getSocRolloverResultIdsByTargetSoc(targetSoc.getId(), callContext);
242 assertEquals(1, resultIds.size());
243 SocRolloverResultInfo result = socService.getSocRolloverResult(resultIds.get(0), callContext);
244 assertEquals(sourceSoc.getId(), result.getSourceSocId());
245 assertEquals(targetSoc.getId(), result.getTargetSocId());
246 assertEquals(targetTerm.getId(), result.getTargetTermId());
247 compareStringList(optionKeys, result.getOptionKeys());
248
249
250
251
252 if (result.getStateKey().equals(CourseOfferingSetServiceConstants.ABORTED_RESULT_STATE_KEY)) {
253 System.out.println("Batch job aborted");
254 if (result.getMessage() != null) {
255 fail(result.getMessage().getPlain());
256 return;
257 }
258 fail("aborted no message");
259 return;
260 }
261
262
263
264
265
266
267 assertEquals(CourseOfferingSetServiceConstants.FINISHED_RESULT_STATE_KEY, result.getStateKey());
268 assertNull(result.getMessage());
269 assertEquals (sourceTerm.getId(), result.getSourceTermId());
270 assertEquals (sourceSoc.getId(), result.getSourceSocId());
271 assertEquals(new Integer(2), result.getItemsExpected());
272 assertEquals(new Integer(2), result.getItemsProcessed());
273 assertEquals (new Integer (2), result.getCourseOfferingsCreated());
274 assertEquals (new Integer (0), result.getCourseOfferingsSkipped());
275 assertEquals (targetTerm.getId(), result.getTargetTermId());
276 assertEquals (targetSoc.getId(), result.getTargetSocId());
277 assertNull(result.getMessage());
278 List<SocRolloverResultItemInfo> items = socService.getSocRolloverResultItemsByResultId(result.getId(), callContext);
279 assertEquals(2, items.size());
280
281
282 SocRolloverResultItemInfo item1 = findBySourceCourseOffering(items, sourceCo1.getId());
283 assertEquals(result.getId(), item1.getSocRolloverResultId());
284 assertEquals(CourseOfferingSetServiceConstants.CREATE_RESULT_ITEM_TYPE_KEY, item1.getTypeKey());
285 assertEquals(CourseOfferingSetServiceConstants.CREATED_RESULT_ITEM_STATE_KEY, item1.getStateKey());
286 assertEquals(sourceCo1.getId(), item1.getSourceCourseOfferingId());
287
288
289 CourseOfferingInfo targetCo1 = coService.getCourseOffering(item1.getTargetCourseOfferingId(), callContext);
290 assertNotNull(targetCo1);
291 assertEquals(sourceCo1.getCourseId(), targetCo1.getCourseId());
292 assertEquals(targetTerm.getId(), targetCo1.getTermId());
293
294
295 assertEquals(sourceCo1.getTypeKey(), targetCo1.getTypeKey());
296 assertEquals(sourceCo1.getCourseOfferingTitle(), targetCo1.getCourseOfferingTitle());
297
298 List<FormatOfferingInfo> targetFo1s = coService.getFormatOfferingsByCourseOffering(targetCo1.getId(), callContext);
299 assertEquals(1, targetFo1s.size());
300 FormatOfferingInfo targetFo1 = targetFo1s.get(0);
301 assertEquals(sourceFo1.getFormatId(), targetFo1.getFormatId());
302 assertEquals(targetTerm.getId(), targetFo1.getTermId());
303
304
305 assertEquals(sourceFo1.getTypeKey(), targetFo1.getTypeKey());
306 assertEquals(sourceFo1.getName(), targetFo1.getName());
307
308 List<ActivityOfferingInfo> targetAo1s = coService.getActivityOfferingsByFormatOffering(targetFo1.getId(), callContext);
309 assertEquals(2, targetAo1s.size());
310 ActivityOfferingInfo targetAo1A = findByCode(targetAo1s, "A");
311 assertNotNull(targetAo1A);
312 assertEquals(sourceAo1A.getActivityId(), targetAo1A.getActivityId());
313 assertEquals(targetTerm.getId(), targetAo1A.getTermId());
314
315
316 assertEquals(sourceAo1A.getTypeKey(), targetAo1A.getTypeKey());
317 assertEquals(sourceAo1A.getName(), targetAo1A.getName());
318 assertEquals(sourceAo1A.getActivityCode(), targetAo1A.getActivityCode());
319
320 ActivityOfferingInfo targetAo1B = findByCode(targetAo1s, "B");
321 assertNotNull(targetAo1B);
322 assertEquals(sourceAo1B.getActivityId(), targetAo1B.getActivityId());
323 assertEquals(targetTerm.getId(), targetAo1B.getTermId());
324
325
326 assertEquals(sourceAo1B.getTypeKey(), targetAo1B.getTypeKey());
327 assertEquals(sourceAo1B.getName(), targetAo1B.getName());
328 assertEquals(sourceAo1B.getActivityCode(), targetAo1B.getActivityCode());
329
330
331 SocRolloverResultItemInfo item2 = findBySourceCourseOffering(items, sourceCo2.getId());
332 assertEquals(result.getId(), item2.getSocRolloverResultId());
333 assertEquals(CourseOfferingSetServiceConstants.CREATE_RESULT_ITEM_TYPE_KEY, item2.getTypeKey());
334 assertEquals(CourseOfferingSetServiceConstants.CREATED_RESULT_ITEM_STATE_KEY, item2.getStateKey());
335 assertEquals(sourceCo2.getId(), item2.getSourceCourseOfferingId());
336
337
338 CourseOfferingInfo targetCo2 = coService.getCourseOffering(item2.getTargetCourseOfferingId(), callContext);
339 assertNotNull(targetCo2);
340 assertEquals(sourceCo2.getCourseId(), targetCo2.getCourseId());
341 assertEquals(targetTerm.getId(), targetCo2.getTermId());
342
343
344 assertEquals(sourceCo2.getTypeKey(), targetCo2.getTypeKey());
345 assertEquals(sourceCo2.getCourseOfferingTitle(), targetCo2.getCourseOfferingTitle());
346
347 List<FormatOfferingInfo> targetFo2s = coService.getFormatOfferingsByCourseOffering(targetCo2.getId(), callContext);
348 assertEquals(1, targetFo2s.size());
349 FormatOfferingInfo targetFo2 = targetFo2s.get(0);
350 assertEquals(sourceFo2.getFormatId(), targetFo2.getFormatId());
351 assertEquals(targetTerm.getId(), targetFo2.getTermId());
352
353
354 assertEquals(sourceFo2.getTypeKey(), targetFo2.getTypeKey());
355 assertEquals(sourceFo2.getName(), targetFo2.getName());
356
357 List<ActivityOfferingInfo> targetAo2s = coService.getActivityOfferingsByFormatOffering(targetFo2.getId(), callContext);
358 assertEquals(2, targetAo2s.size());
359 ActivityOfferingInfo targetAo2A = findByCode(targetAo2s, "A");
360 assertNotNull(targetAo2A);
361 assertEquals(sourceAo2A.getActivityId(), targetAo2A.getActivityId());
362 assertEquals(targetTerm.getId(), targetAo2A.getTermId());
363
364
365 assertEquals(sourceAo2A.getTypeKey(), targetAo2A.getTypeKey());
366 assertEquals(sourceAo2A.getName(), targetAo2A.getName());
367 assertEquals(sourceAo2A.getActivityCode(), targetAo2A.getActivityCode());
368
369 ActivityOfferingInfo targetAo2B = findByCode(targetAo2s, "B");
370 assertNotNull(targetAo2B);
371 assertEquals(sourceAo2B.getActivityId(), targetAo2B.getActivityId());
372 assertEquals(targetTerm.getId(), targetAo2B.getTermId());
373
374
375 assertEquals(sourceAo2B.getTypeKey(), targetAo2B.getTypeKey());
376 assertEquals(sourceAo2B.getName(), targetAo2B.getName());
377 assertEquals(sourceAo2B.getActivityCode(), targetAo2B.getActivityCode());
378 }
379
380 protected List<String> buildRolloverOptionKeys() {
381 List<String> result = new ArrayList<String>();
382 result.add(CourseOfferingSetServiceConstants.LOG_SUCCESSES_OPTION_KEY);
383 result.add(CourseOfferingSetServiceConstants.RUN_SYNCHRONOUSLY_OPTION_KEY);
384 return result;
385 }
386
387 protected SocInfo getTargetSocAfterRollover(String sourceSocId, String targetTermId, List<String> optionKeys, ContextInfo callContext) throws InvalidParameterException, MissingParameterException, DoesNotExistException, PermissionDeniedException, OperationFailedException {
388 SocInfo targetSoc = socService.rolloverSoc(sourceSocId, targetTermId, optionKeys, callContext);
389
390 return targetSoc;
391 }
392
393 private ActivityOfferingInfo findByCode(List<ActivityOfferingInfo> list, String code) {
394 for (ActivityOfferingInfo info : list) {
395 if (code.equals(info.getActivityCode())) {
396 return info;
397 }
398 }
399 return null;
400 }
401
402 private SocRolloverResultItemInfo findBySourceCourseOffering(List<SocRolloverResultItemInfo> list, String sourceCourseOfferingId) {
403 for (SocRolloverResultItemInfo info : list) {
404 if (sourceCourseOfferingId.equals(info.getSourceCourseOfferingId())) {
405 return info;
406 }
407 }
408 return null;
409 }
410
411 private void compareStringList(List<String> list1, List<String> list2) {
412 assertEquals(list1.size(), list2.size());
413 List lst1 = new ArrayList(list1);
414 Collections.sort(lst1);
415 List lst2 = new ArrayList(list2);
416 Collections.sort(lst2);
417 for (int i = 0; i < lst1.size(); i++) {
418 assertEquals(i + "", lst1.get(i), lst2.get(i));
419 }
420 }
421 }