assertNotNull(dart);
assertNotNull(harvard);
assertNotNull(yale);
// Save in order to Dart/Harvard/Yale
SaveSchoolRankCommand comm = new SaveSchoolRankCommand(dart,
getUser(), 0);
executeWithToken(comm, false);
comm = new SaveSchoolRankCommand(harvard, getUser(), 1);
executeWithToken(comm, false);
comm = new SaveSchoolRankCommand(yale, getUser(), 2);
executeWithToken(comm, false);
User savedUser = getUser();
assertEquals(3, savedUser.getSchoolRankings().size());
assertEquals(dart, savedUser.getSchoolRankings().get(0)
.getSchool());
assertEquals(harvard, savedUser.getSchoolRankings().get(1)
.getSchool());
assertEquals(yale, savedUser.getSchoolRankings().get(2)
.getSchool());
log.debug("\n------Re-Order--------");
// re-order to Dart,Yale,Harvard
comm = new SaveSchoolRankCommand(harvard, getUser(), 2);
executeWithToken(comm, false);
savedUser = getUser();
assertEquals(3, savedUser.getSchoolRankings().size());
assertEquals(dart, savedUser.getSchoolRankings().get(0)
.getSchool());
assertEquals(yale, savedUser.getSchoolRankings().get(1)
.getSchool());
assertEquals(harvard, savedUser.getSchoolRankings().get(2)
.getSchool());
// re-order to Harvard,Dart,Yale
comm = new SaveSchoolRankCommand(harvard, getUser(), 0);
executeWithToken(comm, false);
savedUser = getUser();
assertEquals(3, savedUser.getSchoolRankings().size());