Skip to content

Commit

Permalink
row value test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Hakan Ozler <ozler.hakan@gmail.com>
  • Loading branch information
ozlerhakan committed May 16, 2021
1 parent ed94932 commit 3971541
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/test/java/com/poiji/deserialize/RawValueTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.poiji.deserialize;

import com.poiji.bind.Poiji;
import com.poiji.deserialize.model.RowModel;
import com.poiji.option.PoijiOptions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.io.File;
import java.util.Arrays;
import java.util.List;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

/**
* Created by hakan on 02/08/2018
*/
@RunWith(Parameterized.class)
public class RawValueTest {

private String path;

public RawValueTest(String path) {
this.path = path;
}

@Parameterized.Parameters(name = "{index}: ({0})={1}")
public static Iterable<Object[]> queries() {
return Arrays.asList(new Object[][]{
{"src/test/resources/raw_value.xls"},
{"src/test/resources/raw_value.xlsx"},
});
}

@Test
public void shouldMapCalculations() {

PoijiOptions options = PoijiOptions.PoijiOptionsBuilder.settings().headerCount(0).returnNumericRawValues().build();
List<RowModel> models = Poiji.fromExcel(new File(path), RowModel.class, options);

for (RowModel model : models) {
assertThat(model.getRowValue(), is(57363987456321L));
}
}
}
20 changes: 20 additions & 0 deletions src/test/java/com/poiji/deserialize/model/RowModel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.poiji.deserialize.model;

import com.poiji.annotation.ExcelCell;

/**
* Created by hakan on 16.05.2021
*/
public class RowModel {

@ExcelCell(0)
private Long rowValue;

public Long getRowValue() {
return rowValue;
}

public void setRowValue(Long rowValue) {
this.rowValue = rowValue;
}
}

0 comments on commit 3971541

Please sign in to comment.