-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Is not covered Refs: #304
- Loading branch information
Showing
2 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
src/test/java/com/poiji/bind/mapping/HSSFUnmarshallerTest.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,45 @@ | ||
package com.poiji.bind.mapping; | ||
|
||
import com.poiji.annotation.ExcelCellName; | ||
import com.poiji.deserialize.model.InventoryData; | ||
import com.poiji.option.PoijiOptions; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
|
||
import java.lang.reflect.Field; | ||
import java.util.List; | ||
|
||
import static org.junit.Assert.assertNull; | ||
|
||
@RunWith(Parameterized.class) | ||
public class HSSFUnmarshallerTest { | ||
|
||
private final ExcelCellName annotation; | ||
|
||
public HSSFUnmarshallerTest(String fieldName) throws NoSuchFieldException { | ||
Field author = InventoryData.class.getDeclaredField(fieldName); | ||
annotation = author.getAnnotation(ExcelCellName.class); | ||
} | ||
|
||
@Parameterized.Parameters(name = "{index}: ({0})={1}") | ||
public static Iterable<Object[]> queries() { | ||
return List.of(new Object[][]{ | ||
{ | ||
"id" | ||
}, | ||
{ | ||
"author" | ||
}, | ||
}); | ||
} | ||
|
||
@Test | ||
public void shouldFindTitleColumn() { | ||
HSSFUnmarshallerFile hssfUnmarshallerFile = new HSSFUnmarshallerFile(null, PoijiOptions.PoijiOptionsBuilder.settings().build()); | ||
|
||
Integer titleColumn = hssfUnmarshallerFile.findTitleColumn(annotation); | ||
|
||
assertNull(titleColumn); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/test/java/com/poiji/bind/mapping/PoijiHandlerTest.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,45 @@ | ||
package com.poiji.bind.mapping; | ||
|
||
import com.poiji.annotation.ExcelCellName; | ||
import com.poiji.deserialize.model.InventoryData; | ||
import com.poiji.option.PoijiOptions; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
|
||
import java.lang.reflect.Field; | ||
import java.util.List; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
@RunWith(Parameterized.class) | ||
public class PoijiHandlerTest { | ||
|
||
private final ExcelCellName annotation; | ||
|
||
public PoijiHandlerTest(String fieldName) throws NoSuchFieldException { | ||
Field author = InventoryData.class.getDeclaredField(fieldName); | ||
annotation = author.getAnnotation(ExcelCellName.class); | ||
} | ||
|
||
@Parameterized.Parameters(name = "{index}: ({0})={1}") | ||
public static Iterable<Object[]> queries() { | ||
return List.of(new Object[][]{ | ||
{ | ||
"id" | ||
}, | ||
{ | ||
"author" | ||
}, | ||
}); | ||
} | ||
|
||
@Test | ||
public void shouldFindTitleColumn() { | ||
PoijiHandler<InventoryData> poijiHandler = new PoijiHandler<>(InventoryData.class, PoijiOptions.PoijiOptionsBuilder.settings().build(), o -> {}); | ||
|
||
Integer titleColumn = poijiHandler.findTitleColumn(annotation); | ||
|
||
assertNull(titleColumn); | ||
} | ||
} |