Ejemplo n.º 1
0
 @Test
 public void totalOrder() throws RuleBaseException {
   SortBlock block = define("<sort by='ascending' priority='5'>@foo</sort>");
   final OrderGraph graph = mockery.mock(OrderGraph.class);
   mockery.checking(
       new Expectations() {
         {
           one(graph).order("x2", "x1", 5);
           one(graph).order("x2", "x3", 5);
           one(graph).order("x2", "x4", 5);
           one(graph).order("x1", "x4", 5);
           one(graph).order("x3", "x4", 5);
         }
       });
   List<Pair<String, Integer>> list = new ArrayList<Pair<String, Integer>>();
   list.add(Pair.of("x1", 23));
   list.add(Pair.of("x2", 18));
   list.add(Pair.of("x3", 23));
   list.add(Pair.of("x4", 35));
   Comparator<Pair<String, Integer>> comparator =
       new Comparator<Pair<String, Integer>>() {
         public int compare(Pair<String, Integer> o1, Pair<String, Integer> o2) {
           return o1.second.compareTo(o2.second);
         }
       };
   block.totalOrder(list, comparator, graph);
 }