@Test public void testGroupByMonthReverse() throws Exception { DataSet result = dataSetManager.lookupDataSet( DataSetLookupFactory.newDataSetLookupBuilder() .dataset(EXPENSE_REPORTS) .group(COLUMN_DATE).fixed(MONTH, true).desc() .column(COLUMN_DATE, "Period") .column(COUNT, "Occurrences") .column(COLUMN_AMOUNT, SUM, "totalAmount") .buildLookup()); //printDataSet(result); assertDataSetValues(result, dataSetFormatter, new String[][]{ {"12", "4.00", "2,520.88"}, {"11", "3.00", "1,443.75"}, {"10", "3.00", "1,366.40"}, {"9", "3.00", "693.35"}, {"8", "2.00", "452.25"}, {"7", "4.00", "2,354.04"}, {"6", "9.00", "4,113.87"}, {"5", "5.00", "2,503.34"}, {"4", "3.00", "1,061.06"}, {"3", "5.00", "1,012.55"}, {"2", "6.00", "2,885.57"}, {"1", "3.00", "2,324.20"} }, 0); }
@Test public void testGroupByMonthReverse() throws Exception { DataSet result = dataSetManager.lookupDataSet( DataSetLookupFactory.newDataSetLookupBuilder() .dataset(EXPENSE_REPORTS) .group(COLUMN_DATE).fixed(MONTH, true).desc() .column(COLUMN_DATE, "Period") .column(COUNT, "Occurrences") .column(COLUMN_AMOUNT, SUM, "totalAmount") .buildLookup()); //printDataSet(result); assertDataSetValues(result, dataSetFormatter, new String[][]{ {"12", "4.00", "2,520.88"}, {"11", "3.00", "1,443.75"}, {"10", "3.00", "1,366.40"}, {"9", "3.00", "693.35"}, {"8", "2.00", "452.25"}, {"7", "4.00", "2,354.04"}, {"6", "9.00", "4,113.87"}, {"5", "5.00", "2,503.34"}, {"4", "3.00", "1,061.06"}, {"3", "5.00", "1,012.55"}, {"2", "6.00", "2,885.57"}, {"1", "3.00", "2,324.20"} }, 0); }
@Test public void testGroupByMonthFirstMonthReverse() throws Exception { DataSet result = dataSetManager.lookupDataSet( DataSetLookupFactory.newDataSetLookupBuilder() .dataset(EXPENSE_REPORTS) .group(COLUMN_DATE).fixed(MONTH, true).desc().firstMonth(Month.MARCH) .column(COLUMN_DATE, "Period") .column(COUNT, "Occurrences") .column(COLUMN_AMOUNT, SUM, "totalAmount") .buildLookup()); //printDataSet(result); assertDataSetValues(result, dataSetFormatter, new String[][]{ {"3", "5.00", "1,012.55"}, {"2", "6.00", "2,885.57"}, {"1", "3.00", "2,324.20"}, {"12", "4.00", "2,520.88"}, {"11", "3.00", "1,443.75"}, {"10", "3.00", "1,366.40"}, {"9", "3.00", "693.35"}, {"8", "2.00", "452.25"}, {"7", "4.00", "2,354.04"}, {"6", "9.00", "4,113.87"}, {"5", "5.00", "2,503.34"}, {"4", "3.00", "1,061.06"} }, 0); }
@Test public void testGroupByMonthFirstMonthReverse() throws Exception { DataSet result = dataSetManager.lookupDataSet( DataSetLookupFactory.newDataSetLookupBuilder() .dataset(EXPENSE_REPORTS) .group(COLUMN_DATE).fixed(MONTH, true).desc().firstMonth(Month.MARCH) .column(COLUMN_DATE, "Period") .column(COUNT, "Occurrences") .column(COLUMN_AMOUNT, SUM, "totalAmount") .buildLookup()); //printDataSet(result); assertDataSetValues(result, dataSetFormatter, new String[][]{ {"3", "5.00", "1,012.55"}, {"2", "6.00", "2,885.57"}, {"1", "3.00", "2,324.20"}, {"12", "4.00", "2,520.88"}, {"11", "3.00", "1,443.75"}, {"10", "3.00", "1,366.40"}, {"9", "3.00", "693.35"}, {"8", "2.00", "452.25"}, {"7", "4.00", "2,354.04"}, {"6", "9.00", "4,113.87"}, {"5", "5.00", "2,503.34"}, {"4", "3.00", "1,061.06"} }, 0); }