forked from jlawrie/opencsv
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue 3402853 - make integration test out of issue.
- Loading branch information
sconway
committed
Sep 6, 2011
1 parent
5ec5709
commit 81a6198
Showing
4 changed files
with
60 additions
and
74 deletions.
There are no files selected for viewing
73 changes: 0 additions & 73 deletions
73
test/au/com/bytecode/opencsv/bean/HeaderColumnNameMappingStrategyUserTest.java
This file was deleted.
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
test/integrationTest/issue3402853/HeaderColumnNameMappingStrategyUserTest.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,56 @@ | ||
package integrationTest.issue3402853; | ||
|
||
/** | ||
Copyright 2007 Kyle Miller. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
|
||
import au.com.bytecode.opencsv.CSVReader; | ||
import au.com.bytecode.opencsv.bean.CsvToBean; | ||
import au.com.bytecode.opencsv.bean.HeaderColumnNameMappingStrategy; | ||
import org.junit.Test; | ||
|
||
import java.io.FileNotFoundException; | ||
import java.io.FileReader; | ||
import java.util.List; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
public class HeaderColumnNameMappingStrategyUserTest { | ||
|
||
private static final String USER_FILE = "test/integrationTest/issue3402853/user.csv"; | ||
|
||
private List<MockUserBean> createTestParseResult() throws FileNotFoundException { | ||
CSVReader reader = new CSVReader(new FileReader(USER_FILE)); | ||
HeaderColumnNameMappingStrategy<MockUserBean> strat = new HeaderColumnNameMappingStrategy<MockUserBean>(); | ||
strat.setType(MockUserBean.class); | ||
CsvToBean<MockUserBean> csv = new CsvToBean<MockUserBean>(); | ||
return csv.parse(strat, reader); | ||
} | ||
|
||
@Test | ||
public void testParse() throws FileNotFoundException { | ||
List<MockUserBean> list = createTestParseResult(); | ||
assertNotNull(list); | ||
assertEquals(2, list.size()); | ||
MockUserBean bean = list.get(0); | ||
assertEquals("rbst218@yahoo.com", bean.getEmail()); | ||
assertEquals("\"\"CHia Sia Ta", bean.getFirst_Name()); | ||
assertEquals("", bean.getLast_Name()); | ||
assertEquals("bc1er1163", bean.getProfile_Id()); | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...m/bytecode/opencsv/bean/MockUserBean.java → ...rationTest/issue3402853/MockUserBean.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package au.com.bytecode.opencsv.bean; | ||
package integrationTest.issue3402853; | ||
|
||
/** | ||
* Created by IntelliJ IDEA. | ||
|
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,3 @@ | ||
"id","email","profile_id","first_name","last_name" | ||
"475592","rbst218@yahoo.com","bc1er1163","\"\"CHia Sia Ta","" | ||
"12345","kazem.naderi@tt.com","bc234a","kazem","naderi" |