/** * @see BasePageableResult#toSimpleObject(Converter) * @verifies not add property totalCount if context does not contains parameter totalCount */ @Test public void toSimpleObject_shouldNotAddPropertyTotalCountIfContextDoesNotContainsParameterTotalCount() throws Exception { AlreadyPaged<Order> needsPaging = new AlreadyPaged<Order>(context, orders, false, (long) orders.size()); SimpleObject result = needsPaging.toSimpleObject(converter); assertFalse(result.containsKey("totalCount")); } }
/** * @see BasePageableResult#toSimpleObject(Converter) * @verifies add property totalCount if context contains parameter totalCount which is true */ @Test public void toSimpleObject_shouldAddPropertyTotalCountIfContextContainsParameterTotalCountWhichIsTrue() throws Exception { request.addParameter("totalCount", "true"); AlreadyPaged<Order> needsPaging = new AlreadyPaged<Order>(context, orders, false, (long) orders.size()); SimpleObject result = needsPaging.toSimpleObject(converter); assertTrue(result.containsKey("totalCount")); assertThat((Long) result.get("totalCount"), is((long) orders.size())); assertThat(needsPaging.getTotalCount(), is((long) orders.size())); }
/** * @see BasePageableResult#toSimpleObject(Converter) * @verifies not add property totalCount if context contains parameter totalCount which is false */ @Test public void toSimpleObject_shouldNotAddPropertyTotalCountIfContextContainsParameterTotalCountWhichIsFalse() throws Exception { request.addParameter("totalCount", "false"); AlreadyPaged<Order> needsPaging = new AlreadyPaged<Order>(context, orders, false, (long) orders.size()); SimpleObject result = needsPaging.toSimpleObject(converter); assertFalse(result.containsKey("totalCount")); }