1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.opencsv.bean.mocks;
17
18 import com.opencsv.CSVReader;
19 import com.opencsv.bean.MappingStrategy;
20 import com.opencsv.exceptions.CsvBadConverterException;
21 import com.opencsv.exceptions.CsvBeanIntrospectionException;
22 import org.apache.commons.lang3.ArrayUtils;
23
24 public class ErrorLineMappingStrategy<T> implements MappingStrategy<T> {
25 @Override
26 public void captureHeader(CSVReader reader) {
27 }
28
29 @Override
30 public String[] generateHeader(T bean) {
31 return new String[0];
32 }
33
34 @Override
35 public void setType(Class<? extends T> type) throws CsvBadConverterException {}
36
37 @Override
38 public T populateNewBean(String[] line) throws CsvBeanIntrospectionException {
39 throw new CsvBeanIntrospectionException("This is a test exception.");
40 }
41
42 @Override
43 public String[] transmuteBean(T bean) {
44 return ArrayUtils.EMPTY_STRING_ARRAY;
45 }
46 }