### Question:
AdminRuleAdminServiceImpl implements AdminRuleAdminService { @Override public void swap(long id1, long id2) { ruleDAO.swap(id1, id2); }  @Override long insert(AdminRule rule); @Override long insert(AdminRule rule, InsertPosition position); @Override long update(AdminRule rule); @Override int shift(long priorityStart, long offset); @Override void swap(long id1, long id2); @Override AdminRule get(long id); @Override boolean delete(long id); @Override void deleteRulesByUser(String username); @Override void deleteRulesByRole(String rolename); @Override void deleteRulesByInstance(long instanceId); @Override List<ShortAdminRule> getAll(); @Override List<ShortAdminRule> getList(RuleFilter filter, Integer page, Integer entries); @Override ShortAdminRule getRule(RuleFilter filter); @Override List<ShortAdminRule> getRulesByPriority(long priority, Integer page, Integer entries); @Override ShortAdminRule getRuleByPriority(long priority); @Override List<AdminRule> getListFull(RuleFilter filter, Integer page, Integer entries); @Override long getCountAll(); @Override long count(RuleFilter filter); void setAdminRuleDAO(AdminRuleDAO ruleDAO);  }### Answer:
@Test public void testSwap() { assertEquals(0, adminruleAdminService.getCountAll()); AdminRule r1 = new AdminRule(10, null, null, null,null, "w1", AdminGrantType.ADMIN); AdminRule r2 = new AdminRule(20, null, null, null,null, "w2", AdminGrantType.ADMIN); AdminRule r3 = new AdminRule(30, null, null, null,null, "w3", AdminGrantType.ADMIN); adminruleAdminService.insert(r1); adminruleAdminService.insert(r2); adminruleAdminService.insert(r3); adminruleAdminService.swap(r1.getId(), r2.getId()); RuleFilter f = new RuleFilter(RuleFilter.SpecialFilterType.ANY); List<ShortAdminRule> loaded = adminruleAdminService.getList(f, null, null); assertEquals(3, loaded.size()); assertEquals(r2.getId(), loaded.get(0).getId()); assertEquals(r1.getId(), loaded.get(1).getId()); assertEquals(r3.getId(), loaded.get(2).getId()); assertEquals(10, loaded.get(0).getPriority()); assertEquals(20, loaded.get(1).getPriority()); assertEquals(30, loaded.get(2).getPriority()); }