Skip to content

Commit

Permalink
issue 3402853 - make integration test out of issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
sconway committed Sep 6, 2011
1 parent 5ec5709 commit 81a6198
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 74 deletions.

This file was deleted.

@@ -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());
}

}
@@ -1,4 +1,4 @@
package au.com.bytecode.opencsv.bean;
package integrationTest.issue3402853;

/**
* Created by IntelliJ IDEA.
Expand Down
3 changes: 3 additions & 0 deletions test/integrationTest/issue3402853/user.csv
@@ -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"

0 comments on commit 81a6198

Please sign in to comment.