### Question:
RuleAdminServiceImpl implements RuleAdminService { @Override public void swap(long id1, long id2) { ruleDAO.swap(id1, id2); }  @Override long insert(Rule rule); @Override long insert(Rule rule, InsertPosition position); @Override long update(Rule rule); @Override int shift(long priorityStart, long offset); @Override void swap(long id1, long id2); @Override Rule 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<ShortRule> getAll(); @Override List<ShortRule> getList(RuleFilter filter, Integer page, Integer entries); @Override ShortRule getRule(RuleFilter filter); @Override List<ShortRule> getRulesByPriority(long priority, Integer page, Integer entries); @Override ShortRule getRuleByPriority(long priority); @Override List<Rule> getListFull(RuleFilter filter, Integer page, Integer entries); @Override long getCountAll(); @Override long count(RuleFilter filter); @Override void setLimits(Long ruleId, RuleLimits limits); @Override void setDetails(Long ruleId, LayerDetails detailsNew); @Override void setAllowedStyles(Long ruleId, Set<String> styles); @Override Set<String> getAllowedStyles(Long ruleId); void setRuleDAO(RuleDAO ruleDAO); void setRuleLimitsDAO(RuleLimitsDAO ruleLimitsDAO); void setLayerDetailsDAO(LayerDetailsDAO detailsDAO);  }### Answer:
@Test public void testSwap() { assertEquals(0, ruleAdminService.getCountAll()); Rule r1 = new Rule(10, null, null, null,null, "s1", "r1", "w1", "l1", GrantType.ALLOW); Rule r2 = new Rule(20, null, null, null,null, "s2", "r2", "w2", "l2", GrantType.ALLOW); Rule r3 = new Rule(30, null, null, null,null, "s3", "r3", "w3", "l3", GrantType.ALLOW); ruleAdminService.insert(r1); ruleAdminService.insert(r2); ruleAdminService.insert(r3); ruleAdminService.swap(r1.getId(), r2.getId()); RuleFilter f = new RuleFilter(RuleFilter.SpecialFilterType.ANY); List<ShortRule> loaded = ruleAdminService.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()); }