@Test
public void cellValueEqualsTest() {

    // given
    XSSFWorkbook workbook = new XSSFWorkbook();
    XSSFSheet sheet = workbook.createSheet();
    Row r = sheet.createRow(0);
    Cell c1 = r.createCell(0);
    Cell c2 = r.createCell(1);
    // when numeric (double)
    c1.setCellValue(1.000000000000001);
    c2.setCellValue(1);
    // then
    Assertions.assertThat(PivotUtils.cellValueEquals(c1,c2)).isEqualTo(false);
    // when (limits of double comparison)
    c1.setCellValue(1.0000000000000001);
    c2.setCellValue(1);
    // then
    Assertions.assertThat(PivotUtils.cellValueEquals(c1,c2)).isEqualTo(true);
    // when
    c1.setCellValue(1);
    c2.setCellValue(0.9999999999999999);
    // then
    Assertions.assertThat(PivotUtils.cellValueEquals(c1,c2)).isEqualTo(false);
    // when (limits of double comparison)
    c1.setCellValue(1);
    c2.setCellValue(0.99999999999999999);
    // then
    Assertions.assertThat(PivotUtils.cellValueEquals(c1,c2)).isEqualTo(true);
    // when (empty cells or cells with values not set, can't compare)
    c1 = r.createCell(0);
    c2 = r.createCell(1);
    // then
    Assertions.assertThat(PivotUtils.cellValueEquals(c1,c2)).isEqualTo(true);
    // when (type not equal)
    c1 = r.createCell(0);
    c1.setCellType(CellType.BLANK);
    c2 = r.createCell(1);
    c2.setCellType(CellType.BOOLEAN);
    // then
    Assertions.assertThat(PivotUtils.cellValueEquals(c1,c2)).isEqualTo(false);
    // when string
    c1 = r.createCell(0);
    c2 = r.createCell(1);
    c1.setCellValue("a");
    c2.setCellValue("a");
    // then
    Assertions.assertThat(PivotUtils.cellValueEquals(c1,c2)).isEqualTo(true);
    // when case sensitive
    c1.setCellValue("a");
    c2.setCellValue("A");
    // then
    Assertions.assertThat(PivotUtils.cellValueEquals(c1,c2)).isEqualTo(false);
    // when empty string
    c1.setCellValue("");
    c2.setCellValue("");
    // then
    Assertions.assertThat(PivotUtils.cellValueEquals(c1,c2)).isEqualTo(true);
    // when empty string and empty cell
    c1 = r.createCell(0);
    c2 = r.createCell(1);
    c1.setCellValue("");
    // then
    Assertions.assertThat(PivotUtils.cellValueEquals(c1,c2)).isEqualTo(false);
    // when string and numeric
    c1 = r.createCell(0);
    c2 = r.createCell(1);
    c1.setCellValue("a");
    c2.setCellType(CellType.NUMERIC);
    // then
    Assertions.assertThat(PivotUtils.cellValueEquals(c1,c2)).isEqualTo(false);
    // when string and numeric
    c1 = r.createCell(0);
    c2 = r.createCell(1);
    c1.setCellValue("a");
    c2.setCellValue(0);
    // then
    Assertions.assertThat(PivotUtils.cellValueEquals(c1,c2)).isEqualTo(false);
    // when boolean
    c1.setCellValue(true);
    c2.setCellValue(true);
    // then
    Assertions.assertThat(PivotUtils.cellValueEquals(c1,c2)).isEqualTo(true);
    // when
    c1.setCellValue(false);
    c2.setCellValue(true);
    // then
    Assertions.assertThat(PivotUtils.cellValueEquals(c1,c2)).isEqualTo(false);
    // when 0 (false) 1 (true) value in boolean cell supported
    c1.setCellValue(true);
    c2.setCellValue(1);
    c2.setCellType(CellType.BOOLEAN);
    // then
    Assertions.assertThat(PivotUtils.cellValueEquals(c1,c2)).isEqualTo(true);
}