Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #224 from ozlerhakan/3.1.5
3.1.5
- Loading branch information
Showing
10 changed files
with
93 additions
and
28 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: Poiji Build | ||
|
||
on: [push] | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
|
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
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
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
60 changes: 60 additions & 0 deletions
60
src/test/java/com/poiji/deserialize/RawValueLocaleTest.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,60 @@ | ||
package com.poiji.deserialize; | ||
|
||
import com.poiji.bind.Poiji; | ||
import com.poiji.deserialize.model.RowModelDouble; | ||
import com.poiji.option.PoijiOptions; | ||
import org.junit.BeforeClass; | ||
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 java.util.Locale; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* Created by beckerdennis on 07.12.2021 | ||
*/ | ||
@RunWith(Parameterized.class) | ||
public class RawValueLocaleTest { | ||
|
||
private final String path; | ||
private final boolean isRawData; | ||
|
||
public RawValueLocaleTest(String path, boolean isRawData) { | ||
this.path = path; | ||
this.isRawData = isRawData; | ||
} | ||
|
||
@Parameterized.Parameters(name = "{index}: ({0})={1}") | ||
public static Iterable<Object[]> queries() { | ||
return Arrays.asList(new Object[][]{ | ||
{"src/test/resources/raw_value_locale.xls", true}, | ||
{"src/test/resources/raw_value_locale.xlsx", true}, | ||
{"src/test/resources/raw_value_locale.xls", false}, | ||
{"src/test/resources/raw_value_locale.xlsx", false}, | ||
}); | ||
} | ||
|
||
@BeforeClass | ||
public static void setLocaleGermany() { | ||
Locale.setDefault(Locale.GERMANY); | ||
} | ||
|
||
@Test | ||
public void shouldMapRawValueWithDifferentLocale() { | ||
PoijiOptions options = PoijiOptions.PoijiOptionsBuilder.settings().headerCount(0).setLocale(Locale.GERMANY).rawData(isRawData).build(); | ||
List<RowModelDouble> models = Poiji.fromExcel(new File(path), RowModelDouble.class, options); | ||
|
||
for (RowModelDouble model : models) { | ||
if (isRawData) { | ||
assertEquals(0.351D, model.getRowValue(), 0); | ||
} else { | ||
assertEquals(0.4D, model.getRowValue(), 0); | ||
} | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/test/java/com/poiji/deserialize/model/RowModelDouble.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,17 @@ | ||
package com.poiji.deserialize.model; | ||
|
||
import com.poiji.annotation.ExcelCell; | ||
|
||
/** | ||
* Created by beckerdennis on 07.12.2021 | ||
*/ | ||
public class RowModelDouble { | ||
|
||
@ExcelCell(0) | ||
private double rowValue; | ||
|
||
public double getRowValue() { | ||
return rowValue; | ||
} | ||
|
||
} |
Binary file not shown.
Binary file not shown.