-
-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e9827c
commit cd618e5
Showing
4 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/test/java/com/poiji/deserialize/NullReferenceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.poiji.deserialize; | ||
|
||
import com.poiji.bind.Poiji; | ||
import com.poiji.deserialize.model.AutoImport; | ||
import com.poiji.option.PoijiOptions; | ||
import org.junit.Test; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
public class NullReferenceTest { | ||
|
||
@Test | ||
public void shouldReturnEmptyWhenCellReferenceNull() { | ||
PoijiOptions options = PoijiOptions.PoijiOptionsBuilder.settings().disableXLSXNumberCellFormat().build(); | ||
|
||
List<AutoImport> result = Poiji.fromExcel(new File("src/test/resources/autos2.xlsx"), AutoImport.class, options); | ||
|
||
assertNotNull(result); | ||
assertThat(result.size(), is(20)); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.poiji.deserialize.model; | ||
|
||
import com.poiji.annotation.ExcelCell; | ||
import com.poiji.annotation.ExcelCellName; | ||
|
||
import java.time.LocalDate; | ||
|
||
public class AutoImport { | ||
|
||
@ExcelCellName(value = "fabricacion", mandatory = false) | ||
private LocalDate fecha; | ||
|
||
@ExcelCell(0) | ||
private String clase; | ||
|
||
@ExcelCell(1) | ||
private String tipo; | ||
|
||
@ExcelCell(2) | ||
private String subtipo; | ||
|
||
@ExcelCell(3) | ||
private String marca; | ||
|
||
@ExcelCell(4) | ||
private String modelo; | ||
|
||
@ExcelCell(5) | ||
private String submodelo; | ||
|
||
@ExcelCell(6) | ||
private String dsc; | ||
|
||
@ExcelCell(7) | ||
private String pmercado; | ||
|
||
@ExcelCell(8) | ||
private Double ptoma; | ||
|
||
@ExcelCell(9) | ||
private String anio; | ||
|
||
@ExcelCell(10) | ||
private String cil; | ||
|
||
@ExcelCell(11) | ||
private String com; | ||
|
||
@ExcelCell(12) | ||
private String tp; | ||
|
||
@ExcelCell(13) | ||
private Integer pasajeros; | ||
|
||
@ExcelCell(14) | ||
private Integer puertas; | ||
|
||
} |