@Test public void resolve_orderByKey() { OrderByClause orderByClause = new OrderByClause(); orderByClause.setOrderByMode(OrderByMode.ORDER_BY_KEY); Query query = PowerMockito.mock(Query.class); ResolverQueryOrderBy resolver = new ResolverQueryOrderBy(); resolver.resolve(orderByClause, query); Mockito.verify(query, VerificationModeFactory.times(1)).orderByKey(); }
@Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } }
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } } }
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } }  }
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } }  @Override Query resolve(OrderByClause orderByClause, Query target); }
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } }  @Override Query resolve(OrderByClause orderByClause, Query target);  }