@Test
public void testPivoting_WithTwoValues_works() throws Exception {

    // given
    List<String> annotations = Arrays.asList("row", "value", "column", "deco", "deco", "value");
    List<Integer> orderNumbers = Arrays.asList(0, 1, 1, 2, 1, 2);
    List<String> typeList = Arrays.asList(null, "SUM", null, null, null, "COUNT");
    List<String> fieldNameList = Arrays.asList("fn1", "fn2", "fn3", "fn4", "fn5", "fn2a");
    List<?> v1 = Arrays.asList("l1", 1, "c1", "d1-f-l1", "d2-f-l1", 2);
    List<?> v2 = Arrays.asList("l2", 2, "c2", "deco for l2", null, null);
    List<?> v3 = Arrays.asList("l1", 3, "c1", "other deco not used", null, 2);
    List<?> v4 = Arrays.asList("l3", 33, "c1", null, null, 2);
    sourceSheetBuilder(annotations, orderNumbers, typeList, fieldNameList, v1, v2, v3, v4);
    // when
    p.pivot(sourceSheet, targetSheet);
    // then
    Assertions.assertThat(targetSheet.getLastRowNum()).isEqualTo(5);
    testRow(0, null, null, "fn3", "c1", null, "c2", null);
    testRow(1, "fn1", "fn5", "fn4", "fn2 (sum)", "fn2a (count)", "fn2 (sum)", "fn2a (count)");
    testRow(2, "l1", "d2-f-l1", "d1-f-l1", 4, 2, null, null);
    testRow(3, "l2", null, "deco for l2", null, null, 2, 1);
    testRow(4, "l3", null, null, 33, 1, null, null);
    Assertions.assertThat(targetSheet.getRow(5).getCell(3).getCellFormula()).isEqualTo("SUM(D3:D5)");
    Assertions.assertThat(targetSheet.getRow(5).getCell(4).getCellFormula()).isEqualTo("SUM(E3:E5)");
    Assertions.assertThat(targetSheet.getRow(5).getCell(5).getCellFormula()).isEqualTo("SUM(F3:F5)");
    Assertions.assertThat(targetSheet.getRow(5).getCell(6).getCellFormula()).isEqualTo("SUM(G3:G5)");
}