SimpleName:IDENTIFIER 239 getFieldAccessor getFieldAccessor

SimpleName:IDENTIFIER 239 ErrorCsv ErrorCsv

SimpleName:IDENTIFIER 239 comparator comparator

SimpleName:IDENTIFIER 240 builder builder

SimpleName:IDENTIFIER 240 StringProcessorBuilder StringProcessorBuilder

SimpleName:IDENTIFIER 240 builderResolver builderResolver

SimpleName:IDENTIFIER 240 resolve resolve

SimpleName:IDENTIFIER 241 formatter formatter

SimpleName:IDENTIFIER 241 builder builder

SimpleName:IDENTIFIER 241 getFormatter getFormatter

SimpleName:IDENTIFIER 243 getAnnotationsByGroup getAnnotationsByGroup

SimpleName:IDENTIFIER 243 CsvWordForbid CsvWordForbid

SimpleName:IDENTIFIER 243 groupEmpty groupEmpty

SimpleName:IDENTIFIER 246 factory factory

SimpleName:IDENTIFIER 246 Optional Optional

SimpleName:IDENTIFIER 246 formatter formatter

"'%s' において、アノテーション @CsvWordForbid の属性 'value or provider' の指定は必須です。"

@Test
public void testCreate_attrNoValueProvider() {
    FieldAccessor field = getFieldAccessor(ErrorCsv.class, "col_no_value_provider", comparator);
    StringProcessorBuilder builder = (StringProcessorBuilder) builderResolver.resolve(String.class);
    TextFormatter<String> formatter = builder.getFormatter(field, config);
    CsvWordForbid anno = field.getAnnotationsByGroup(CsvWordForbid.class, groupEmpty).get(0);
    factory.create(anno, Optional.empty(), field, formatter, config);
}

@Test(expected = Exception.class)
public void testCreate_attrNoValueProvider() {
    FieldAccessor field = getFieldAccessor(ErrorCsv.class, "col_no_value_provider", comparator);
    StringProcessorBuilder builder = (StringProcessorBuilder) builderResolver.resolve(String.class);
    TextFormatter<String> formatter = builder.getFormatter(field, config);
    CsvWordForbid anno = field.getAnnotationsByGroup(CsvWordForbid.class, groupEmpty).get(0);
    factory.create(anno, Optional.empty(), field, formatter, config);
}

package com.github.mygreen.supercsv.cellprocessor.constraint;

import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import static com.github.mygreen.supercsv.tool.TestUtils.*;
import static com.github.mygreen.supercsv.tool.HasCellProcessorAssert.*;
import java.io.File;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.supercsv.cellprocessor.ift.CellProcessor;
import com.github.mygreen.supercsv.annotation.CsvBean;
import com.github.mygreen.supercsv.annotation.CsvColumn;
import com.github.mygreen.supercsv.annotation.constraint.CsvWordForbid;
import com.github.mygreen.supercsv.builder.ProcessorBuilderResolver;
import com.github.mygreen.supercsv.builder.BeanMapping;
import com.github.mygreen.supercsv.builder.BeanMappingFactory;
import com.github.mygreen.supercsv.builder.ColumnMapping;
import com.github.mygreen.supercsv.builder.Configuration;
import com.github.mygreen.supercsv.builder.FieldAccessor;
import com.github.mygreen.supercsv.builder.standard.StringProcessorBuilder;
import com.github.mygreen.supercsv.cellprocessor.format.TextFormatter;
import com.github.mygreen.supercsv.exception.SuperCsvInvalidAnnotationException;
import com.github.mygreen.supercsv.exception.SuperCsvValidationException;
import com.github.mygreen.supercsv.validation.CsvExceptionConverter;

public class adhoc_WordForbidFactoryTest {

    @Rule
    public TestName name = new TestName();

    private WordForbidFactory factory;

    private Configuration config;

    private Comparator<Annotation> comparator;

    private ProcessorBuilderResolver builderResolver;

    private BeanMappingFactory beanMappingFactory;

    private CsvExceptionConverter exceptionConverter;

    private final Class<?>[] groupEmpty = new Class[] {};

    @Before
    public void setUp() throws Exception {
        this.factory = new WordForbidFactory();
        this.config = new Configuration();
        this.beanMappingFactory = new BeanMappingFactory();
        beanMappingFactory.setConfiguration(config);
        this.exceptionConverter = new CsvExceptionConverter();
        this.comparator = config.getAnnoationComparator();
        this.builderResolver = config.getBuilderResolver();
    }

    private static final String TEST_VALUE_VALID_INPUT = "今日はいい天気です。";

    private static final String TEST_VALUE_WRONG_INPUT = "今日は馬鹿で阿呆な奴に会った。馬鹿馬鹿しいです。";

    @CsvBean
    private static class TestCsv {

        @CsvColumn(number = 1, label = "カラム1")
        @CsvWordForbid(value = { "馬鹿", "阿呆" })
        private String col_default;

        @CsvColumn(number = 2)
        @CsvWordForbid(provider = FileForbidWordProvider.class)
        private String col_provider;

        @CsvColumn(number = 10)
        @CsvWordForbid(value = { "馬鹿", "阿呆" }, message = "テストメッセージ")
        private String col_message;

        @CsvColumn(number = 11)
        @CsvWordForbid(value = { "馬鹿", "阿呆" }, message = "")
        private String col_message_empty;

        @CsvColumn(number = 12)
        @CsvWordForbid(value = { "馬鹿", "阿呆" }, message = "lineNumber={lineNumber}, rowNumber={rowNumber}, columnNumber={columnNumber}, label={label}, validatedValue={validatedValue}, words=${f:join(words, ', ')}")
        private String col_message_variables;
    }

    @CsvBean
    private static class ErrorCsv {

        @CsvColumn(number = 1)
        @CsvWordForbid
        private String col_no_value_provider;
    }

    private static class FileForbidWordProvider implements ForbiddenWordProvider {

        @Override
        public Collection<String> getForbiddenWords(final FieldAccessor field) {
            try {
                return Files.readAllLines(new File("src/test/data/data_forbidden_word.txt").toPath(), Charset.forName("UTF-8"));
            } catch (IOException e) {
                throw new RuntimeException("fail reading the forbbden file.", e);
            }
        }
    }
    /*TEST PLACEHOLDER*/
}

属性value, providerの指定がない


SimpleName:IDENTIFIER 207 getFieldAccessor getFieldAccessor

SimpleName:IDENTIFIER 207 ErrorCsv ErrorCsv

SimpleName:IDENTIFIER 207 comparator comparator

SimpleName:IDENTIFIER 208 builder builder

SimpleName:IDENTIFIER 208 StringProcessorBuilder StringProcessorBuilder

SimpleName:IDENTIFIER 208 builderResolver builderResolver

SimpleName:IDENTIFIER 208 resolve resolve

SimpleName:IDENTIFIER 209 formatter formatter

SimpleName:IDENTIFIER 209 builder builder

SimpleName:IDENTIFIER 209 getFormatter getFormatter

SimpleName:IDENTIFIER 211 getAnnotationsByGroup getAnnotationsByGroup

SimpleName:IDENTIFIER 211 CsvWordReplace CsvWordReplace

SimpleName:IDENTIFIER 211 groupEmpty groupEmpty

SimpleName:IDENTIFIER 215 factory factory

SimpleName:IDENTIFIER 215 Optional Optional

SimpleName:IDENTIFIER 215 formatter formatter

"'%s' において、アノテーション @CsvWordReplace の属性 'words' と 'replacements' の配列のサイズが一致しません。設定されている属性 'words' のサイズは2、'replacements' のサイズは1です。"

@Test
public void testCreate_error_sizeNoMatch() {
    FieldAccessor field = getFieldAccessor(ErrorCsv.class, "col_size_noMatch", comparator);
    StringProcessorBuilder builder = (StringProcessorBuilder) builderResolver.resolve(String.class);
    TextFormatter<String> formatter = builder.getFormatter(field, config);
    CsvWordReplace anno = field.getAnnotationsByGroup(CsvWordReplace.class, groupEmpty).get(0);
    factory.create(anno, Optional.empty(), field, formatter, config);
}

@Test(expected = Exception.class)
public void testCreate_error_sizeNoMatch() {
    FieldAccessor field = getFieldAccessor(ErrorCsv.class, "col_size_noMatch", comparator);
    StringProcessorBuilder builder = (StringProcessorBuilder) builderResolver.resolve(String.class);
    TextFormatter<String> formatter = builder.getFormatter(field, config);
    CsvWordReplace anno = field.getAnnotationsByGroup(CsvWordReplace.class, groupEmpty).get(0);
    factory.create(anno, Optional.empty(), field, formatter, config);
}

package com.github.mygreen.supercsv.cellprocessor.conversion;

import static org.junit.Assert.*;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.*;
import static com.github.mygreen.supercsv.tool.TestUtils.*;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.supercsv.cellprocessor.ift.CellProcessor;
import com.github.mygreen.supercsv.annotation.CsvBean;
import com.github.mygreen.supercsv.annotation.CsvColumn;
import com.github.mygreen.supercsv.annotation.conversion.CsvWordReplace;
import com.github.mygreen.supercsv.builder.AnnotationComparator;
import com.github.mygreen.supercsv.builder.ProcessorBuilderResolver;
import com.github.mygreen.supercsv.builder.BuildCase;
import com.github.mygreen.supercsv.builder.Configuration;
import com.github.mygreen.supercsv.builder.FieldAccessor;
import com.github.mygreen.supercsv.builder.standard.StringProcessorBuilder;
import com.github.mygreen.supercsv.cellprocessor.format.TextFormatter;
import com.github.mygreen.supercsv.exception.SuperCsvInvalidAnnotationException;

public class adhoc_WordReplaceFactoryTest {

    @Rule
    public TestName name = new TestName();

    private WordReplaceFactory factory;

    private Configuration config;

    private final Class<?>[] groupEmpty = new Class[] {};

    private final AnnotationComparator comparator = new AnnotationComparator();

    private final ProcessorBuilderResolver builderResolver = new ProcessorBuilderResolver();

    @Before
    public void setUp() throws Exception {
        this.factory = new WordReplaceFactory();
        this.config = new Configuration();
    }

    @CsvBean
    private static class TestCsv {

        @CsvColumn(number = 1)
        @CsvWordReplace(words = { "下さい", "御願い" }, replacements = { "ください", "お願い" })
        private String col_default;

        @CsvColumn(number = 2)
        @CsvWordReplace(provider = FileReplacedWordProvider.class)
        private String col_provider;
    }

    @CsvBean
    private static class ErrorCsv {

        @CsvColumn(number = 1)
        @CsvWordReplace(words = { "下さい", "御願い" }, replacements = { "ください" })
        private String col_size_noMatch;

        @CsvColumn(number = 1)
        @CsvWordReplace
        private String col_no_value_provider;
    }

    private static class FileReplacedWordProvider implements ReplacedWordProvider {

        @Override
        public Collection<Word> getReplacedWords(final FieldAccessor field) {
            final List<String> lines;
            try {
                lines = Files.readAllLines(new File("src/test/data/data_replaced_word.txt").toPath(), Charset.forName("UTF-8"));
            } catch (IOException e) {
                throw new RuntimeException("fail reading the replaced words file.", e);
            }
            return lines.stream().map(l -> l.split(",")).map(s -> new Word(s[0], s[1])).collect(Collectors.toList());
        }
    }
    /*TEST PLACEHOLDER*/
}

語彙の個数が一致しない場合

語彙の個数が一致しない場合

SimpleName:IDENTIFIER 235 getFieldAccessor getFieldAccessor

SimpleName:IDENTIFIER 235 ErrorCsv ErrorCsv

SimpleName:IDENTIFIER 235 comparator comparator

SimpleName:IDENTIFIER 236 builder builder

SimpleName:IDENTIFIER 236 StringProcessorBuilder StringProcessorBuilder

SimpleName:IDENTIFIER 236 builderResolver builderResolver

SimpleName:IDENTIFIER 236 resolve resolve

SimpleName:IDENTIFIER 237 formatter formatter

SimpleName:IDENTIFIER 237 builder builder

SimpleName:IDENTIFIER 237 getFormatter getFormatter

SimpleName:IDENTIFIER 239 getAnnotationsByGroup getAnnotationsByGroup

SimpleName:IDENTIFIER 239 CsvWordReplace CsvWordReplace

SimpleName:IDENTIFIER 239 groupEmpty groupEmpty

SimpleName:IDENTIFIER 242 factory factory

SimpleName:IDENTIFIER 242 Optional Optional

SimpleName:IDENTIFIER 242 formatter formatter

@Test
public void testCreate_attrNoValueProvider() {
    FieldAccessor field = getFieldAccessor(ErrorCsv.class, "col_no_value_provider", comparator);
    StringProcessorBuilder builder = (StringProcessorBuilder) builderResolver.resolve(String.class);
    TextFormatter<String> formatter = builder.getFormatter(field, config);
    CsvWordReplace anno = field.getAnnotationsByGroup(CsvWordReplace.class, groupEmpty).get(0);
    factory.create(anno, Optional.empty(), field, formatter, config);
}

@Test(expected = Exception.class)
public void testCreate_attrNoValueProvider() {
    FieldAccessor field = getFieldAccessor(ErrorCsv.class, "col_no_value_provider", comparator);
    StringProcessorBuilder builder = (StringProcessorBuilder) builderResolver.resolve(String.class);
    TextFormatter<String> formatter = builder.getFormatter(field, config);
    CsvWordReplace anno = field.getAnnotationsByGroup(CsvWordReplace.class, groupEmpty).get(0);
    factory.create(anno, Optional.empty(), field, formatter, config);
}

属性value, providerの指定がない


SimpleName:IDENTIFIER 196 getFieldAccessor getFieldAccessor

SimpleName:IDENTIFIER 196 ErrorCsv ErrorCsv

SimpleName:IDENTIFIER 196 comparator comparator

SimpleName:IDENTIFIER 197 builder builder

SimpleName:IDENTIFIER 197 StringProcessorBuilder StringProcessorBuilder

SimpleName:IDENTIFIER 197 builderResolver builderResolver

SimpleName:IDENTIFIER 197 resolve resolve

SimpleName:IDENTIFIER 198 formatter formatter

SimpleName:IDENTIFIER 198 builder builder

SimpleName:IDENTIFIER 198 getFormatter getFormatter

SimpleName:IDENTIFIER 200 getAnnotationsByGroup getAnnotationsByGroup

SimpleName:IDENTIFIER 200 CsvTruncate CsvTruncate

SimpleName:IDENTIFIER 200 groupEmpty groupEmpty

SimpleName:IDENTIFIER 202 factory factory

SimpleName:IDENTIFIER 202 Optional Optional

SimpleName:IDENTIFIER 202 formatter formatter

"'%s' において、アノテーション @CsvTruncate の属性 'maxSize' の値（0）は、1以上の値を設定してください。"

@Test
public void testCreate_wrong_maxSize() {
    FieldAccessor field = getFieldAccessor(ErrorCsv.class, "col_wrong_maxSize", comparator);
    StringProcessorBuilder builder = (StringProcessorBuilder) builderResolver.resolve(String.class);
    TextFormatter<String> formatter = builder.getFormatter(field, config);
    CsvTruncate anno = field.getAnnotationsByGroup(CsvTruncate.class, groupEmpty).get(0);
    factory.create(anno, Optional.empty(), field, formatter, config);
}

@Test(expected = Exception.class)
public void testCreate_wrong_maxSize() {
    FieldAccessor field = getFieldAccessor(ErrorCsv.class, "col_wrong_maxSize", comparator);
    StringProcessorBuilder builder = (StringProcessorBuilder) builderResolver.resolve(String.class);
    TextFormatter<String> formatter = builder.getFormatter(field, config);
    CsvTruncate anno = field.getAnnotationsByGroup(CsvTruncate.class, groupEmpty).get(0);
    factory.create(anno, Optional.empty(), field, formatter, config);
}

package com.github.mygreen.supercsv.cellprocessor.conversion;

import static org.junit.Assert.*;
import java.util.Optional;
import static org.assertj.core.api.Assertions.*;
import static com.github.mygreen.supercsv.tool.TestUtils.*;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.supercsv.cellprocessor.ift.CellProcessor;
import com.github.mygreen.supercsv.annotation.CsvBean;
import com.github.mygreen.supercsv.annotation.CsvColumn;
import com.github.mygreen.supercsv.annotation.conversion.CsvTruncate;
import com.github.mygreen.supercsv.builder.AnnotationComparator;
import com.github.mygreen.supercsv.builder.ProcessorBuilderResolver;
import com.github.mygreen.supercsv.builder.BuildCase;
import com.github.mygreen.supercsv.builder.Configuration;
import com.github.mygreen.supercsv.builder.FieldAccessor;
import com.github.mygreen.supercsv.builder.standard.StringProcessorBuilder;
import com.github.mygreen.supercsv.cellprocessor.format.TextFormatter;
import com.github.mygreen.supercsv.exception.SuperCsvInvalidAnnotationException;

public class adhoc_TruncateFactoryTest {

    @Rule
    public TestName name = new TestName();

    private TruncateFactory factory;

    private Configuration config;

    private final Class<?>[] groupEmpty = new Class[] {};

    private final AnnotationComparator comparator = new AnnotationComparator();

    private final ProcessorBuilderResolver builderResolver = new ProcessorBuilderResolver();

    @Before
    public void setUp() throws Exception {
        this.factory = new TruncateFactory();
        this.config = new Configuration();
    }

    @CsvBean
    private static class TestCsv {

        @CsvColumn(number = 1)
        @CsvTruncate(maxSize = 3)
        private String col_default;

        @CsvColumn(number = 2)
        @CsvTruncate(maxSize = 3, suffix = "...")
        private String col_suffix;
    }

    @CsvBean
    private static class ErrorCsv {

        @CsvTruncate(maxSize = 0)
        private String col_wrong_maxSize;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 183 getFieldAccessor getFieldAccessor

SimpleName:IDENTIFIER 183 ErrorCsv ErrorCsv

SimpleName:IDENTIFIER 183 comparator comparator

SimpleName:IDENTIFIER 184 builder builder

SimpleName:IDENTIFIER 184 StringProcessorBuilder StringProcessorBuilder

SimpleName:IDENTIFIER 184 builderResolver builderResolver

SimpleName:IDENTIFIER 184 resolve resolve

SimpleName:IDENTIFIER 185 formatter formatter

SimpleName:IDENTIFIER 185 builder builder

SimpleName:IDENTIFIER 185 getFormatter getFormatter

SimpleName:IDENTIFIER 187 getAnnotationsByGroup getAnnotationsByGroup

SimpleName:IDENTIFIER 187 CsvRegexReplace CsvRegexReplace

SimpleName:IDENTIFIER 187 groupEmpty groupEmpty

SimpleName:IDENTIFIER 189 factory factory

SimpleName:IDENTIFIER 189 Optional Optional

SimpleName:IDENTIFIER 189 formatter formatter

"'%s' において、アノテーション @CsvRegexReplace の属性 'regex' の値（test)test）は、正規表現として不正です。"

@Test
public void testCreate_wrong_pattern() {
    FieldAccessor field = getFieldAccessor(ErrorCsv.class, "col_wrong_pattern", comparator);
    StringProcessorBuilder builder = (StringProcessorBuilder) builderResolver.resolve(String.class);
    TextFormatter<String> formatter = builder.getFormatter(field, config);
    CsvRegexReplace anno = field.getAnnotationsByGroup(CsvRegexReplace.class, groupEmpty).get(0);
    factory.create(anno, Optional.empty(), field, formatter, config);
}

@Test(expected = Exception.class)
public void testCreate_wrong_pattern() {
    FieldAccessor field = getFieldAccessor(ErrorCsv.class, "col_wrong_pattern", comparator);
    StringProcessorBuilder builder = (StringProcessorBuilder) builderResolver.resolve(String.class);
    TextFormatter<String> formatter = builder.getFormatter(field, config);
    CsvRegexReplace anno = field.getAnnotationsByGroup(CsvRegexReplace.class, groupEmpty).get(0);
    factory.create(anno, Optional.empty(), field, formatter, config);
}

package com.github.mygreen.supercsv.cellprocessor.conversion;

import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import static com.github.mygreen.supercsv.tool.TestUtils.*;
import java.util.Optional;
import java.util.regex.Pattern;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.supercsv.cellprocessor.ift.CellProcessor;
import com.github.mygreen.supercsv.annotation.CsvBean;
import com.github.mygreen.supercsv.annotation.CsvColumn;
import com.github.mygreen.supercsv.annotation.PatternFlag;
import com.github.mygreen.supercsv.annotation.conversion.CsvRegexReplace;
import com.github.mygreen.supercsv.builder.AnnotationComparator;
import com.github.mygreen.supercsv.builder.ProcessorBuilderResolver;
import com.github.mygreen.supercsv.builder.BuildCase;
import com.github.mygreen.supercsv.builder.Configuration;
import com.github.mygreen.supercsv.builder.FieldAccessor;
import com.github.mygreen.supercsv.builder.standard.StringProcessorBuilder;
import com.github.mygreen.supercsv.cellprocessor.format.TextFormatter;
import com.github.mygreen.supercsv.exception.SuperCsvInvalidAnnotationException;

public class adhoc_RegexReplaceFactoryTest {

    @Rule
    public TestName name = new TestName();

    private RegexReplaceFactory factory;

    private Configuration config;

    private final Class<?>[] groupEmpty = new Class[] {};

    private final AnnotationComparator comparator = new AnnotationComparator();

    private final ProcessorBuilderResolver builderResolver = new ProcessorBuilderResolver();

    @Before
    public void setUp() throws Exception {
        this.factory = new RegexReplaceFactory();
        this.config = new Configuration();
    }

    @CsvBean
    private static class TestCsv {

        @CsvColumn(number = 1)
        @CsvRegexReplace(regex = "([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})", replacement = "$1年$2月$3日", flags = PatternFlag.CASE_INSENSITIVE)
        private String col_default;

        @CsvColumn(number = 2)
        @CsvRegexReplace(regex = "Word", replacement = "Replace", partialMatched = true)
        private String col_partial;
    }

    @CsvBean
    private static class ErrorCsv {

        @CsvRegexReplace(regex = "test)test", replacement = "wrong")
        private String col_wrong_pattern;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 52 expected expected

SimpleName:IDENTIFIER 52 NullPointerException NullPointerException

SimpleName:IDENTIFIER 54 Truncate Truncate

@Test(expected = NullPointerException.class)
public void testConstructor_nextNull() {
    new Truncate(MAX_SIZE, SUFFIX, null);
    fail();
}

package com.github.mygreen.supercsv.cellprocessor.conversion;

import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import static com.github.mygreen.supercsv.tool.TestUtils.*;
import org.junit.Before;
import org.junit.Test;
import org.supercsv.cellprocessor.ift.CellProcessor;

public class adhoc_TruncateTest {

    private static final int MAX_SIZE = 3;

    private static final String SUFFIX = "...";

    private CellProcessor processor;

    private CellProcessor processorChain;

    private CellProcessor processorSuffix;

    private CellProcessor processorSuffixChain;

    @Before
    public void setUp() {
        processor = new Truncate(MAX_SIZE, "");
        processorChain = new Truncate(MAX_SIZE, "", new NextCellProcessor());
        processorSuffix = new Truncate(MAX_SIZE, SUFFIX);
        processorSuffixChain = new Truncate(MAX_SIZE, SUFFIX, new NextCellProcessor());
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 298 getFieldAccessor getFieldAccessor

SimpleName:IDENTIFIER 298 ErrorCsv ErrorCsv

SimpleName:IDENTIFIER 298 comparator comparator

SimpleName:IDENTIFIER 299 builder builder

SimpleName:IDENTIFIER 299 StringProcessorBuilder StringProcessorBuilder

SimpleName:IDENTIFIER 299 builderResolver builderResolver

SimpleName:IDENTIFIER 299 resolve resolve

SimpleName:IDENTIFIER 300 formatter formatter

SimpleName:IDENTIFIER 300 builder builder

SimpleName:IDENTIFIER 300 getFormatter getFormatter

SimpleName:IDENTIFIER 302 getAnnotationsByGroup getAnnotationsByGroup

SimpleName:IDENTIFIER 302 CsvMultiPad CsvMultiPad

SimpleName:IDENTIFIER 302 groupEmpty groupEmpty

SimpleName:IDENTIFIER 304 factory factory

SimpleName:IDENTIFIER 304 Optional Optional

SimpleName:IDENTIFIER 304 formatter formatter

"'%s' において、アノテーション @CsvMultiPad の属性 'size' の値（0）は、1以上の値を設定してください。"

@Test
public void testCreate_wrong_size() {
    FieldAccessor field = getFieldAccessor(ErrorCsv.class, "col_wrong_size", comparator);
    StringProcessorBuilder builder = (StringProcessorBuilder) builderResolver.resolve(String.class);
    TextFormatter<String> formatter = builder.getFormatter(field, config);
    CsvMultiPad anno = field.getAnnotationsByGroup(CsvMultiPad.class, groupEmpty).get(0);
    factory.create(anno, Optional.empty(), field, formatter, config);
}

@Test(expected = Exception.class)
public void testCreate_wrong_size() {
    FieldAccessor field = getFieldAccessor(ErrorCsv.class, "col_wrong_size", comparator);
    StringProcessorBuilder builder = (StringProcessorBuilder) builderResolver.resolve(String.class);
    TextFormatter<String> formatter = builder.getFormatter(field, config);
    CsvMultiPad anno = field.getAnnotationsByGroup(CsvMultiPad.class, groupEmpty).get(0);
    factory.create(anno, Optional.empty(), field, formatter, config);
}

package com.github.mygreen.supercsv.cellprocessor.conversion;

import static org.junit.Assert.*;
import static com.github.mygreen.supercsv.tool.TestUtils.*;
import static org.assertj.core.api.Assertions.*;
import java.util.Optional;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.supercsv.cellprocessor.ift.CellProcessor;
import com.github.mygreen.supercsv.annotation.CsvBean;
import com.github.mygreen.supercsv.annotation.CsvColumn;
import com.github.mygreen.supercsv.annotation.conversion.CsvMultiPad;
import com.github.mygreen.supercsv.builder.AnnotationComparator;
import com.github.mygreen.supercsv.builder.Configuration;
import com.github.mygreen.supercsv.builder.FieldAccessor;
import com.github.mygreen.supercsv.builder.ProcessorBuilderResolver;
import com.github.mygreen.supercsv.builder.standard.StringProcessorBuilder;
import com.github.mygreen.supercsv.cellprocessor.format.TextFormatter;
import com.github.mygreen.supercsv.exception.SuperCsvInvalidAnnotationException;

public class adhoc_MultiPadFactoryTest {

    @Rule
    public TestName name = new TestName();

    private MultiPadFactory factory;

    private Configuration config;

    private final Class<?>[] groupEmpty = new Class[] {};

    private final AnnotationComparator comparator = new AnnotationComparator();

    private final ProcessorBuilderResolver builderResolver = new ProcessorBuilderResolver();

    @Before
    public void setUp() throws Exception {
        this.factory = new MultiPadFactory();
        this.config = new Configuration();
    }

    @CsvBean
    private static class TestCsv {

        @CsvColumn(number = 1)
        @CsvMultiPad(size = 5)
        private String col_default;

        @CsvColumn(number = 2)
        @CsvMultiPad(size = 5, padChar = '-', rightAlign = true)
        private String col_rightPad;

        @CsvColumn(number = 3)
        @CsvMultiPad(size = 5, chopped = true)
        private String col_chopped;

        @CsvColumn(number = 4)
        @CsvMultiPad(size = 5, chopped = true, paddingProcessor = CharWidthPaddingProcessor.class)
        private String col_paddingProcessor;
    }

    @CsvBean
    private static class ErrorCsv {

        @CsvColumn(number = 1)
        @CsvMultiPad(size = 0)
        private String col_wrong_size;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 174 getFieldAccessor getFieldAccessor

SimpleName:IDENTIFIER 174 ErrorCsv ErrorCsv

SimpleName:IDENTIFIER 174 comparator comparator

SimpleName:IDENTIFIER 175 builder builder

SimpleName:IDENTIFIER 175 StringProcessorBuilder StringProcessorBuilder

SimpleName:IDENTIFIER 175 builderResolver builderResolver

SimpleName:IDENTIFIER 175 resolve resolve

SimpleName:IDENTIFIER 176 formatter formatter

SimpleName:IDENTIFIER 176 builder builder

SimpleName:IDENTIFIER 176 getFormatter getFormatter

SimpleName:IDENTIFIER 178 getAnnotationsByGroup getAnnotationsByGroup

SimpleName:IDENTIFIER 178 CsvRightPad CsvRightPad

SimpleName:IDENTIFIER 178 groupEmpty groupEmpty

SimpleName:IDENTIFIER 181 factory factory

SimpleName:IDENTIFIER 181 Optional Optional

SimpleName:IDENTIFIER 181 formatter formatter

"'%s' において、アノテーション @CsvRightPad の属性 'size' の値（0）は、1以上の値を設定してください。"

@Test
public void testCreate_wornd_size() {
    FieldAccessor field = getFieldAccessor(ErrorCsv.class, "col_wrong_size", comparator);
    StringProcessorBuilder builder = (StringProcessorBuilder) builderResolver.resolve(String.class);
    TextFormatter<String> formatter = builder.getFormatter(field, config);
    CsvRightPad anno = field.getAnnotationsByGroup(CsvRightPad.class, groupEmpty).get(0);
    factory.create(anno, Optional.empty(), field, formatter, config);
}

@Test(expected = Exception.class)
public void testCreate_wornd_size() {
    FieldAccessor field = getFieldAccessor(ErrorCsv.class, "col_wrong_size", comparator);
    StringProcessorBuilder builder = (StringProcessorBuilder) builderResolver.resolve(String.class);
    TextFormatter<String> formatter = builder.getFormatter(field, config);
    CsvRightPad anno = field.getAnnotationsByGroup(CsvRightPad.class, groupEmpty).get(0);
    factory.create(anno, Optional.empty(), field, formatter, config);
}

package com.github.mygreen.supercsv.cellprocessor.conversion;

import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import static com.github.mygreen.supercsv.tool.TestUtils.*;
import java.util.Optional;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.supercsv.cellprocessor.ift.CellProcessor;
import com.github.mygreen.supercsv.annotation.CsvBean;
import com.github.mygreen.supercsv.annotation.CsvColumn;
import com.github.mygreen.supercsv.annotation.conversion.CsvRightPad;
import com.github.mygreen.supercsv.builder.AnnotationComparator;
import com.github.mygreen.supercsv.builder.ProcessorBuilderResolver;
import com.github.mygreen.supercsv.builder.BuildCase;
import com.github.mygreen.supercsv.builder.Configuration;
import com.github.mygreen.supercsv.builder.FieldAccessor;
import com.github.mygreen.supercsv.builder.standard.StringProcessorBuilder;
import com.github.mygreen.supercsv.cellprocessor.format.TextFormatter;
import com.github.mygreen.supercsv.exception.SuperCsvInvalidAnnotationException;

public class adhoc_RightPadFactoryTest {

    @Rule
    public TestName name = new TestName();

    private RightPadFactory factory;

    private Configuration config;

    private final Class<?>[] groupEmpty = new Class[] {};

    private final AnnotationComparator comparator = new AnnotationComparator();

    private final ProcessorBuilderResolver builderResolver = new ProcessorBuilderResolver();

    @Before
    public void setUp() throws Exception {
        this.factory = new RightPadFactory();
        this.config = new Configuration();
    }

    @CsvBean
    private static class TestCsv {

        @CsvColumn(number = 1)
        @CsvRightPad(size = 5)
        private String col_default;

        @CsvColumn(number = 1)
        @CsvRightPad(size = 5, padChar = '_')
        private String col_padChar;
    }

    @CsvBean
    private static class ErrorCsv {

        @CsvColumn(number = 1)
        @CsvRightPad(size = 0)
        private String col_wrong_size;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 30 expected expected

SimpleName:IDENTIFIER 30 NullPointerException NullPointerException

@Test(expected = NullPointerException.class)
public void testConstructor_nextNull() {
    new Trim(null);
    fail();
}

package com.github.mygreen.supercsv.cellprocessor.conversion;

import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import static com.github.mygreen.supercsv.tool.TestUtils.*;
import org.junit.Before;
import org.junit.Test;
import org.supercsv.cellprocessor.ift.CellProcessor;

public class adhoc_TrimTest {

    private CellProcessor processor;

    private CellProcessor processorChain;

    @Before
    public void setUp() {
        processor = new Trim();
        processorChain = new Trim(new NextCellProcessor());
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 174 getFieldAccessor getFieldAccessor

SimpleName:IDENTIFIER 174 ErrorCsv ErrorCsv

SimpleName:IDENTIFIER 174 comparator comparator

SimpleName:IDENTIFIER 175 builder builder

SimpleName:IDENTIFIER 175 StringProcessorBuilder StringProcessorBuilder

SimpleName:IDENTIFIER 175 builderResolver builderResolver

SimpleName:IDENTIFIER 175 resolve resolve

SimpleName:IDENTIFIER 176 formatter formatter

SimpleName:IDENTIFIER 176 builder builder

SimpleName:IDENTIFIER 176 getFormatter getFormatter

SimpleName:IDENTIFIER 178 getAnnotationsByGroup getAnnotationsByGroup

SimpleName:IDENTIFIER 178 CsvLeftPad CsvLeftPad

SimpleName:IDENTIFIER 178 groupEmpty groupEmpty

SimpleName:IDENTIFIER 181 factory factory

SimpleName:IDENTIFIER 181 Optional Optional

SimpleName:IDENTIFIER 181 formatter formatter

"'%s' において、アノテーション @CsvLeftPad の属性 'size' の値（0）は、1以上の値を設定してください。"

@Test
public void testCreate_wornd_size() {
    FieldAccessor field = getFieldAccessor(ErrorCsv.class, "col_wrong_size", comparator);
    StringProcessorBuilder builder = (StringProcessorBuilder) builderResolver.resolve(String.class);
    TextFormatter<String> formatter = builder.getFormatter(field, config);
    CsvLeftPad anno = field.getAnnotationsByGroup(CsvLeftPad.class, groupEmpty).get(0);
    factory.create(anno, Optional.empty(), field, formatter, config);
}

@Test(expected = Exception.class)
public void testCreate_wornd_size() {
    FieldAccessor field = getFieldAccessor(ErrorCsv.class, "col_wrong_size", comparator);
    StringProcessorBuilder builder = (StringProcessorBuilder) builderResolver.resolve(String.class);
    TextFormatter<String> formatter = builder.getFormatter(field, config);
    CsvLeftPad anno = field.getAnnotationsByGroup(CsvLeftPad.class, groupEmpty).get(0);
    factory.create(anno, Optional.empty(), field, formatter, config);
}

package com.github.mygreen.supercsv.cellprocessor.conversion;

import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import static com.github.mygreen.supercsv.tool.TestUtils.*;
import java.util.Optional;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.supercsv.cellprocessor.ift.CellProcessor;
import com.github.mygreen.supercsv.annotation.CsvBean;
import com.github.mygreen.supercsv.annotation.CsvColumn;
import com.github.mygreen.supercsv.annotation.conversion.CsvLeftPad;
import com.github.mygreen.supercsv.builder.AnnotationComparator;
import com.github.mygreen.supercsv.builder.ProcessorBuilderResolver;
import com.github.mygreen.supercsv.builder.BuildCase;
import com.github.mygreen.supercsv.builder.Configuration;
import com.github.mygreen.supercsv.builder.FieldAccessor;
import com.github.mygreen.supercsv.builder.standard.StringProcessorBuilder;
import com.github.mygreen.supercsv.cellprocessor.format.TextFormatter;
import com.github.mygreen.supercsv.exception.SuperCsvInvalidAnnotationException;

public class adhoc_LeftPadFactoryTest {

    @Rule
    public TestName name = new TestName();

    private LeftPadFactory factory;

    private Configuration config;

    private final Class<?>[] groupEmpty = new Class[] {};

    private final AnnotationComparator comparator = new AnnotationComparator();

    private final ProcessorBuilderResolver builderResolver = new ProcessorBuilderResolver();

    @Before
    public void setUp() throws Exception {
        this.factory = new LeftPadFactory();
        this.config = new Configuration();
    }

    @CsvBean
    private static class TestCsv {

        @CsvColumn(number = 1)
        @CsvLeftPad(size = 5)
        private String col_default;

        @CsvColumn(number = 1)
        @CsvLeftPad(size = 5, padChar = '_')
        private String col_padChar;
    }

    @CsvBean
    private static class ErrorCsv {

        @CsvColumn(number = 1)
        @CsvLeftPad(size = 0)
        private String col_wrong_size;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 61 expected expected

SimpleName:IDENTIFIER 61 NullPointerException NullPointerException

SimpleName:IDENTIFIER 64 FieldAccessor FieldAccessor

SimpleName:IDENTIFIER 64 comparator comparator

@Test(expected = NullPointerException.class)
public void testConstructor_arg_null() {
    new FieldAccessor(null, comparator);
}

package com.github.mygreen.supercsv.builder;

import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Field;
import java.time.LocalDate;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import com.github.mygreen.supercsv.annotation.CsvBean;
import com.github.mygreen.supercsv.annotation.CsvColumn;
import com.github.mygreen.supercsv.annotation.CsvComposition;
import com.github.mygreen.supercsv.annotation.CsvOverridesAttribute;
import com.github.mygreen.supercsv.annotation.DefaultGroup;
import com.github.mygreen.supercsv.annotation.constraint.CsvLengthMax;
import com.github.mygreen.supercsv.annotation.constraint.CsvNumberRange;
import com.github.mygreen.supercsv.annotation.constraint.CsvRequire;
import com.github.mygreen.supercsv.builder.FieldAccessor;
import com.github.mygreen.supercsv.io.SampleNormalBean;

public class adhoc_FieldAccessorTest {

    private Comparator<Annotation> comparator;

    @Before
    public void setUp() throws Exception {
        this.comparator = new AnnotationComparator();
    }

    @CsvBean
    private static class SampleBean {

        @CsvColumn(number = 1, label = "列1")
        @CsvLengthMax(value = 100)
        private String col1;

        @CsvColumn(number = 2)
        @CsvNumberRange(min = "50", max = "200", groups = { Group1.class })
        private int col2;

        @CsvColumn(number = 3)
        @CsvNumberRange(min = "50", max = "200", groups = { DefaultGroup.class })
        private int col3;

        @CsvColumn(number = 4)
        @CsvNumberRange(min = "1", max = "100")
        @CsvNumberRange(min = "50", max = "200", groups = { Group1.class })
        private LocalDate col4;

        @CsvColumn(number = 5)
        @CsvUsername(message = "ユーザ名は不正です。", maxLength = 20)
        private String col5;
    }

    private interface Group1 {
    }

    private interface Group2 {
    }

    @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    @CsvComposition
    @CsvRequire
    @CsvLengthMax(value = 64, order = 2, groups = { DefaultGroup.class })
    @CsvLengthMax(value = 10, order = 1, groups = { Group1.class })
    public @interface CsvUsername {

        String message() default "";

        @CsvOverridesAttribute(annotation = CsvLengthMax.class, name = "value", index = 1)
        int maxLength() default 0;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 138 expected expected

SimpleName:IDENTIFIER 138 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 139 Exception Exception

SimpleName:IDENTIFIER 141 SampleBean SampleBean

SimpleName:IDENTIFIER 141 getDeclaredField getDeclaredField

SimpleName:IDENTIFIER 142 property property

SimpleName:IDENTIFIER 142 FieldAccessor FieldAccessor

SimpleName:IDENTIFIER 142 comparator comparator

SimpleName:IDENTIFIER 144 property property

SimpleName:IDENTIFIER 144 getValue getValue

SimpleName:IDENTIFIER 144 SampleNormalBean SampleNormalBean

@Test(expected = IllegalArgumentException.class)
public void testGetValue_wrongType() throws Exception {
    Field field = SampleBean.class.getDeclaredField("col1");
    FieldAccessor property = new FieldAccessor(field, comparator);
    property.getValue(new SampleNormalBean());
    fail();
}

{@link FieldAccessor#getValue(Object)}

Beanのタイプが不一致


SimpleName:IDENTIFIER 54 expected expected

SimpleName:IDENTIFIER 54 NullPointerException NullPointerException

SimpleName:IDENTIFIER 57 AnnotationExpander AnnotationExpander

@Test(expected = NullPointerException.class)
public void testConstructor_argNull() {
    new AnnotationExpander(null);
    fail();
}

package com.github.mygreen.supercsv.builder;

import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Field;
import java.util.Date;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import com.github.mygreen.supercsv.annotation.CsvColumn;
import com.github.mygreen.supercsv.annotation.CsvComposition;
import com.github.mygreen.supercsv.annotation.CsvOverridesAttribute;
import com.github.mygreen.supercsv.annotation.DefaultGroup;
import com.github.mygreen.supercsv.annotation.constraint.CsvNumberMax;
import com.github.mygreen.supercsv.annotation.constraint.CsvLengthMax;
import com.github.mygreen.supercsv.annotation.constraint.CsvDateTimeMax;
import com.github.mygreen.supercsv.annotation.constraint.CsvNumberRange;
import com.github.mygreen.supercsv.annotation.constraint.CsvRequire;
import com.github.mygreen.supercsv.annotation.constraint.CsvUnique;
import com.github.mygreen.supercsv.annotation.conversion.CsvLower;
import com.github.mygreen.supercsv.annotation.conversion.CsvTrim;
import com.github.mygreen.supercsv.annotation.format.CsvDateTimeFormat;
import com.github.mygreen.supercsv.exception.SuperCsvInvalidAnnotationException;

public class adhoc_AnnotationExpanderTest {

    private AnnotationExpander expander;

    @Before
    public void setUp() throws Exception {
        this.expander = new AnnotationExpander(new AnnotationComparator());
    }

    private static Field getSampleField(final String fieldName) {
        try {
            final Field field = SampleCsv.class.getDeclaredField(fieldName);
            field.setAccessible(true);
            return field;
        } catch (Exception e) {
            throw new RuntimeException(String.format("fail get field : '%s'.", fieldName), e);
        }
    }

    private static class SampleCsv {

        @CsvColumn(number = 1, label = "test")
        private int normal;

        @CsvDateTimeFormat(pattern = "yyyy/MM/dd")
        @CsvColumn(number = 2, label = "test")
        @CsvDateTimeMax(value = "2050/10/21", order = 5)
        @CsvUnique(order = 3)
        @CsvLower(order = 1)
        @CsvTrim(order = 10)
        private Date multi;

        @CsvLengthMax(value = 10)
        private String repeatSingle;

        @CsvLengthMax(value = 10)
        @CsvLengthMax(value = 20)
        @CsvLengthMax(value = 30)
        private String repeatMulti;

        @ComposeSimple(value = "simple")
        private Integer composeSimple;

        @ComposeSimple(value = "repeat-1")
        @ComposeSimple(value = "repeat-2")
        private Integer composeSimpleRepeat;

        @ComposeOverrideCustom(value = "override-custom", max1 = "5")
        private Integer composeOverrideCustom;

        @ComposeOverrideDefault1(value = "override-default-1", message = "値は不正です", groups = { DefaultGroup.class, Group2.class }, cases = { BuildCase.Read, BuildCase.Write })
        private Integer composeOverrideDefault1;

        @ComposeOverrideDefault2(value = "override-default-2", message = "値は不正です", groups = { DefaultGroup.class, Group2.class }, rangeMessage = "範囲内に設定してください", rangeGroups = { Group2.class }, rangeCases = { BuildCase.Read, BuildCase.Write })
        private Integer composeOverrideDefault2;

        @ComposeOverrideDefault3(value = "override-default-3", message = "値は不正です", groups = { DefaultGroup.class, Group2.class }, cases = { BuildCase.Read, BuildCase.Write })
        private Integer composeOverrideDefault3;

        @ComposeOverrideDefault4(value = "override-default-4", max = "5")
        private Integer composeOverrideDefault4;

        @ComposeOverrideAttrNotFound1(value = "v", test = "t")
        private Integer composeOverrideAttrNotFound1;

        @ComposeOverrideAttrNotFound2(value = "v", test = "t")
        private Integer composeOverrideAttrNotFound2;
    }

    private interface Group1 {
    }

    private interface Group2 {
    }

    @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    @Repeatable(ComposeSimple.List.class)
    @CsvComposition
    @CsvRequire
    @CsvNumberMax(value = "20", order = 2)
    @CsvNumberMax(value = "30", order = 1)
    public static @interface ComposeSimple {

        String value();

        @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
        @Retention(RetentionPolicy.RUNTIME)
        @Documented
        @interface List {

            ComposeSimple[] value();
        }
    }

    @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    @Repeatable(ComposeOverrideCustom.List.class)
    @CsvComposition
    @CsvRequire(considerBlank = false, considerEmpty = false, message = "必須です")
    @CsvNumberRange(min = "0", max = "20", order = 2)
    @CsvNumberRange(min = "0", max = "30", order = 1)
    public static @interface ComposeOverrideCustom {

        String value();

        @CsvOverridesAttribute(annotation = CsvRequire.class, name = "considerBlank")
        @CsvOverridesAttribute(annotation = CsvRequire.class, name = "considerEmpty")
        boolean considerSpace() default true;

        @CsvOverridesAttribute(annotation = CsvNumberRange.class, name = "max", index = 0)
        String max1();

        @CsvOverridesAttribute(annotation = CsvNumberRange.class, name = "max", index = 1)
        @CsvOverridesAttribute(annotation = CsvNumberRange.class, name = "min", index = 1)
        String max2() default "2";

        @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
        @Retention(RetentionPolicy.RUNTIME)
        @Documented
        @interface List {

            ComposeOverrideCustom[] value();
        }
    }

    @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    @Repeatable(ComposeOverrideDefault1.List.class)
    @CsvComposition
    @CsvRequire(message = "必須です", groups = { Group2.class })
    @CsvNumberRange(min = "0", max = "20", order = 2, groups = { Group1.class }, cases = BuildCase.Read)
    @CsvNumberRange(min = "0", max = "30", order = 1, cases = BuildCase.Write)
    public static @interface ComposeOverrideDefault1 {

        String value();

        String message() default "";

        Class<?>[] groups() default {};

        BuildCase[] cases() default {};

        @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
        @Retention(RetentionPolicy.RUNTIME)
        @Documented
        @interface List {

            ComposeOverrideDefault1[] value();
        }
    }

    @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    @Repeatable(ComposeOverrideDefault2.List.class)
    @CsvComposition
    @CsvRequire(message = "必須です", groups = { Group2.class })
    @CsvNumberRange(min = "0", max = "20", order = 2, groups = { Group1.class }, cases = BuildCase.Write)
    @CsvNumberRange(min = "0", max = "30", order = 1, cases = BuildCase.Read)
    public static @interface ComposeOverrideDefault2 {

        String value();

        String message() default "";

        @CsvOverridesAttribute(annotation = CsvNumberRange.class, name = "message", index = 0)
        String rangeMessage() default "";

        Class<?>[] groups() default {};

        @CsvOverridesAttribute(annotation = CsvNumberRange.class, name = "groups", index = 0)
        Class<?>[] rangeGroups() default {};

        @CsvOverridesAttribute(annotation = CsvNumberRange.class, name = "cases", index = 1)
        BuildCase[] rangeCases() default {};

        @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
        @Retention(RetentionPolicy.RUNTIME)
        @Documented
        @interface List {

            ComposeOverrideDefault2[] value();
        }
    }

    @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    @Repeatable(ComposeOverrideDefault3.List.class)
    @CsvComposition
    @CsvRequire(message = "必須です", groups = { Group2.class }, cases = { BuildCase.Write })
    @CsvNumberRange(min = "0", max = "20", order = 2, groups = { Group1.class }, cases = { BuildCase.Read })
    @CsvNumberRange(min = "0", max = "30", order = 1)
    public static @interface ComposeOverrideDefault3 {

        String value();

        @CsvOverridesAttribute(annotation = CsvNumberRange.class, name = "message", index = 0)
        String message() default "";

        @CsvOverridesAttribute(annotation = CsvNumberRange.class, name = "cases", index = 0)
        BuildCase[] cases() default {};

        @CsvOverridesAttribute(annotation = CsvNumberRange.class, name = "groups", index = 0)
        Class<?>[] groups() default {};

        @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
        @Retention(RetentionPolicy.RUNTIME)
        @Documented
        @interface List {

            ComposeOverrideDefault3[] value();
        }
    }

    @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    @CsvComposition
    @Repeatable(ComposeOverrideDefault4.List.class)
    @CsvNumberRange(min = "0", max = "20", order = 2, groups = { Group1.class })
    @CsvNumberRange(min = "0", max = "30", order = 1)
    public static @interface ComposeOverrideDefault4 {

        String value();

        @CsvOverridesAttribute(annotation = CsvNumberRange.class, index = 0)
        String max();

        @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
        @Retention(RetentionPolicy.RUNTIME)
        @Documented
        @interface List {

            ComposeOverrideDefault4[] value();
        }
    }

    @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    @Repeatable(ComposeOverrideAttrNotFound1.List.class)
    @CsvComposition
    @CsvRequire(message = "必須です")
    @CsvNumberRange(min = "0", max = "30", order = 1)
    public static @interface ComposeOverrideAttrNotFound1 {

        String value();

        @CsvOverridesAttribute(annotation = CsvNumberRange.class, name = "test")
        String test();

        @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
        @Retention(RetentionPolicy.RUNTIME)
        @Documented
        @interface List {

            ComposeOverrideAttrNotFound1[] value();
        }
    }

    @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    @Repeatable(ComposeOverrideAttrNotFound2.List.class)
    @CsvComposition
    @CsvRequire(message = "必須です")
    @CsvNumberRange(min = "0", max = "30", order = 1)
    public static @interface ComposeOverrideAttrNotFound2 {

        String value();

        @CsvOverridesAttribute(annotation = CsvNumberRange.class, name = "test", index = 1)
        String test();

        @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
        @Retention(RetentionPolicy.RUNTIME)
        @Documented
        @interface List {

            ComposeOverrideAttrNotFound2[] value();
        }
    }
    /*TEST PLACEHOLDER*/
}

コンストラクタのテスト - 引数がnullの場合

コンストラクタのテスト - 引数がnullの場合


SimpleName:IDENTIFIER 66 expected expected

SimpleName:IDENTIFIER 66 NullPointerException NullPointerException

SimpleName:IDENTIFIER 68 expander expander

SimpleName:IDENTIFIER 68 Annotation Annotation

@Test(expected = NullPointerException.class)
public void testExpandAnnotationArray_argNull() {
    expander.expand((Annotation[]) null);
    fail();
}

{@link AnnotationExpander#expand(Annotation[])} のテスタ

引数がnullの場合


SimpleName:IDENTIFIER 76 expected expected

SimpleName:IDENTIFIER 76 NullPointerException NullPointerException

SimpleName:IDENTIFIER 78 expander expander

SimpleName:IDENTIFIER 78 Annotation Annotation

@Test(expected = NullPointerException.class)
public void testExpandAnnotation_argNull() {
    expander.expand((Annotation) null);
    fail();
}

{@link AnnotationExpander#expand(Annotation)} のテスタ

引数がnullの場合


SimpleName:IDENTIFIER 511 beanMapping beanMapping

SimpleName:IDENTIFIER 511 beanMappingFactory beanMappingFactory

SimpleName:IDENTIFIER 511 TestCustomFormatterCsv TestCustomFormatterCsv

SimpleName:IDENTIFIER 511 groupEmpty groupEmpty

SimpleName:IDENTIFIER 512 columnMapping columnMapping

SimpleName:IDENTIFIER 512 beanMapping beanMapping

SimpleName:IDENTIFIER 512 getColumnMapping getColumnMapping

SimpleName:IDENTIFIER 514 processor processor

SimpleName:IDENTIFIER 514 columnMapping columnMapping

SimpleName:IDENTIFIER 514 getCellProcessorForWriting getCellProcessorForWriting

SimpleName:IDENTIFIER 516 printCellProcessorChain printCellProcessorChain

SimpleName:IDENTIFIER 516 processor processor

SimpleName:IDENTIFIER 516 getMethodName getMethodName

SimpleName:IDENTIFIER 520 processor processor

SimpleName:IDENTIFIER 520 execute execute

SimpleName:IDENTIFIER 520 testCsvContext testCsvContext

SimpleName:IDENTIFIER 520 columnMapping columnMapping

"[2行, 1列] : 項目「col_default」の値の書き込みに失敗しました。"

@Test
public void testErrorMessage_default_write() {
    BeanMapping<TestCustomFormatterCsv> beanMapping = beanMappingFactory.create(TestCustomFormatterCsv.class, groupEmpty);
    ColumnMapping columnMapping = beanMapping.getColumnMapping("col_default").get();
    CellProcessor processor = columnMapping.getCellProcessorForWriting();
    printCellProcessorChain(processor, name.getMethodName());
    SampleObject input = TEST_VALUE_OBJ_WRONG;
    processor.execute(input, testCsvContext(columnMapping, input));
}

@Test(expected = Exception.class)
public void testErrorMessage_default_write() {
    BeanMapping<TestCustomFormatterCsv> beanMapping = beanMappingFactory.create(TestCustomFormatterCsv.class, groupEmpty);
    ColumnMapping columnMapping = beanMapping.getColumnMapping("col_default").get();
    CellProcessor processor = columnMapping.getCellProcessorForWriting();
    printCellProcessorChain(processor, name.getMethodName());
    SampleObject input = TEST_VALUE_OBJ_WRONG;
    processor.execute(input, testCsvContext(columnMapping, input));
}

package com.github.mygreen.supercsv.builder;

import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
import static com.github.mygreen.supercsv.tool.TestUtils.*;
import static com.github.mygreen.supercsv.tool.HasCellProcessorAssert.*;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.List;
import java.util.ResourceBundle;
import javax.xml.XMLConstants;
import javax.xml.bind.DataBindingException;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.supercsv.cellprocessor.ift.CellProcessor;
import org.xml.sax.SAXException;
import com.github.mygreen.supercsv.annotation.CsvBean;
import com.github.mygreen.supercsv.annotation.CsvColumn;
import com.github.mygreen.supercsv.annotation.format.CsvFormat;
import com.github.mygreen.supercsv.cellprocessor.format.AbstractTextFormatter;
import com.github.mygreen.supercsv.cellprocessor.format.TextFormatter;
import com.github.mygreen.supercsv.cellprocessor.format.TextParseException;
import com.github.mygreen.supercsv.cellprocessor.format.TextPrintException;
import com.github.mygreen.supercsv.exception.SuperCsvInvalidAnnotationException;
import com.github.mygreen.supercsv.exception.SuperCsvValidationException;
import com.github.mygreen.supercsv.localization.EncodingControl;
import com.github.mygreen.supercsv.localization.MessageResolver;
import com.github.mygreen.supercsv.localization.ResourceBundleMessageResolver;
import com.github.mygreen.supercsv.validation.CsvExceptionConverter;

public class adhoc_GeneralProcessorBuilderTest {

    @Rule
    public TestName name = new TestName();

    private BeanMappingFactory beanMappingFactory;

    private CsvExceptionConverter exceptionConverter;

    private final Class<?>[] groupEmpty = new Class[] {};

    private MessageResolver testMessageResolver;

    @Before
    public void setUp() {
        this.beanMappingFactory = new BeanMappingFactory();
        this.exceptionConverter = new CsvExceptionConverter();
        this.testMessageResolver = new ResourceBundleMessageResolver(ResourceBundle.getBundle("TestMessages", new EncodingControl("UTF-8")));
    }

    private static final String TEST_VALUE_STR_VALID = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "\n<sample id=\"id1\">" + "\n    <value>Hello World!</value>" + "\n</sample>" + "\n";

    private static final String TEST_VALUE_STR_WRONG = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "\n<sample>" + "\n    <value>Hello World!</value>" + "\n</sample>" + "\n";

    private static final SampleObject TEST_VALUE_OBJ_VALID = new SampleObject("id1", "Hello World!");

    private static final SampleObject TEST_VALUE_OBJ_WRONG = new SampleObject(null, "Hello World!");

    @CsvBean
    private static class TestCustomFormatterCsv {

        @CsvColumn(number = 1)
        @CsvFormat(formatter = SampleObjectFormatter.class)
        private SampleObject col_default;

        @CsvColumn(number = 2)
        @CsvFormat(formatter = SampleObjectFormatter.class, message = "テストメッセージ")
        private SampleObject col_message;

        @CsvColumn(number = 3, builder = SampleObjectBuilder.class)
        private SampleObject col_builder;
    }

    @CsvBean
    private static class TestErrorNotFormatterCsv {

        @CsvColumn(number = 1)
        private SampleObject col_default;
    }

    @XmlRootElement(name = "sample")
    @XmlAccessorType(XmlAccessType.FIELD)
    private static class SampleObject {

        @XmlAttribute(required = true)
        private String id;

        @XmlElement(name = "value")
        private String data;

        public SampleObject() {
        }

        public SampleObject(final String id, final String data) {
            this.id = id;
            this.data = data;
        }

        @Override
        public int hashCode() {
            final int prime = 31;
            int result = 1;
            result = prime * result + ((data == null) ? 0 : data.hashCode());
            result = prime * result + ((id == null) ? 0 : id.hashCode());
            return result;
        }

        @Override
        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj == null) {
                return false;
            }
            if (!(obj instanceof SampleObject)) {
                return false;
            }
            SampleObject other = (SampleObject) obj;
            if (data == null) {
                if (other.data != null) {
                    return false;
                }
            } else if (!data.equals(other.data)) {
                return false;
            }
            if (id == null) {
                if (other.id != null) {
                    return false;
                }
            } else if (!id.equals(other.id)) {
                return false;
            }
            return true;
        }
    }

    private static class SampleObjectFormatter extends AbstractTextFormatter<SampleObject> {

        private static Schema schema;

        static {
            try {
                SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
                schema = factory.newSchema(adhoc_GeneralProcessorBuilderTest.class.getResource("SampleObject.xsd"));
            } catch (SAXException e) {
                throw new RuntimeException("fail loading schema.", e);
            }
        }

        private static JAXBContext context;

        static {
            try {
                context = JAXBContext.newInstance(SampleObject.class);
            } catch (JAXBException e) {
                throw new RuntimeException("fail create jaxbcontext.", e);
            }
        }

        @Override
        public SampleObject parse(final String text) {
            try {
                Unmarshaller unmashaller = context.createUnmarshaller();
                unmashaller.setSchema(schema);
                SampleObject object = (SampleObject) unmashaller.unmarshal(new StringReader(text));
                return object;
            } catch (JAXBException | DataBindingException e) {
                throw new TextParseException(text, SampleObject.class);
            }
        }

        @Override
        public String print(final SampleObject object) {
            try (StringWriter writer = new StringWriter()) {
                Marshaller marshaller = context.createMarshaller();
                marshaller.setSchema(schema);
                marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
                marshaller.marshal(object, writer);
                writer.flush();
                String text = writer.toString();
                return text;
            } catch (IOException | JAXBException | DataBindingException e) {
                throw new TextPrintException(object, e);
            }
        }
    }

    private static class SampleObjectBuilder extends AbstractProcessorBuilder<SampleObject> {

        @Override
        protected TextFormatter<SampleObject> getDefaultFormatter(FieldAccessor field, Configuration config) {
            return new SampleObjectFormatter();
        }
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 52 expected expected

SimpleName:IDENTIFIER 52 ExpressionEvaluationException ExpressionEvaluationException

SimpleName:IDENTIFIER 55 expression expression

StringLiteralExpr:LITERAL
55
"aaa ?  label"
"aaa ?  label"

SimpleName:IDENTIFIER 57 HashMap HashMap

SimpleName:IDENTIFIER 59 evaluate evaluate

SimpleName:IDENTIFIER 59 expression expression

@Test(expected = ExpressionEvaluationException.class)
public void test_error_exp() {
    String expression = "aaa ?  label";
    Map<String, Object> vars = new HashMap<>();
    el.evaluate(expression, vars);
    fail();
}

package com.github.mygreen.supercsv.expression;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;

public class adhoc_ExpressionLanguageJEXLImplTest {

    private ExpressionLanguageJEXLImpl el;

    @Before
    public void setUp() throws Exception {
        this.el = new ExpressionLanguageJEXLImpl();
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 42 expected expected

SimpleName:IDENTIFIER 42 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 43 testMissingJob testMissingJob

SimpleName:IDENTIFIER 44 JobValidator JobValidator

@Test(expected = IllegalArgumentException.class)
public void testMissingJob() {
    new JobValidator(null);
}

package org.eluder.coveralls.maven.plugin.validation;

import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import org.eluder.coveralls.maven.plugin.domain.Git;
import org.eluder.coveralls.maven.plugin.domain.Git.Head;
import org.eluder.coveralls.maven.plugin.domain.Job;
import org.eluder.coveralls.maven.plugin.validation.ValidationError.Level;
import org.junit.Test;

public class adhoc_JobValidatorTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 46 expected expected

SimpleName:IDENTIFIER 46 ValidationException ValidationException

SimpleName:IDENTIFIER 47 testThrowOrInformWithError testThrowOrInformWithError

SimpleName:IDENTIFIER 48 createValidationErrors createValidationErrors

SimpleName:IDENTIFIER 48 ValidationError ValidationError

StringLiteralExpr:LITERAL 48 "message" "message"

SimpleName:IDENTIFIER 48 throwOrInform throwOrInform

SimpleName:IDENTIFIER 48 logMock logMock

@Test(expected = ValidationException.class)
public void testThrowOrInformWithError() {
    createValidationErrors(new ValidationError(Level.ERROR, "message")).throwOrInform(logMock);
}

package org.eluder.coveralls.maven.plugin.validation;

import static org.mockito.Matchers.any;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import org.apache.maven.plugin.logging.Log;
import org.eluder.coveralls.maven.plugin.validation.ValidationError.Level;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class adhoc_ValidationErrorsTest {

    @Mock
    private Log logMock;

    private ValidationErrors createValidationErrors(final ValidationError... errors) {
        ValidationErrors validationErrors = new ValidationErrors();
        for (ValidationError error : errors) {
            validationErrors.add(error);
        }
        return validationErrors;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 36 expected expected

SimpleName:IDENTIFIER 36 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 37 testMissingLevel testMissingLevel

SimpleName:IDENTIFIER 38 ValidationError ValidationError

StringLiteralExpr:LITERAL 38 "message" "message"

@Test(expected = IllegalArgumentException.class)
public void testMissingLevel() {
    new ValidationError(null, "message");
}

package org.eluder.coveralls.maven.plugin.validation;

import static org.junit.Assert.assertEquals;
import org.eluder.coveralls.maven.plugin.validation.ValidationError.Level;
import org.junit.Test;

public class adhoc_ValidationErrorTest {
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 41 expected expected

SimpleName:IDENTIFIER 41 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 42 testMissingMessage testMissingMessage

SimpleName:IDENTIFIER 43 ValidationError ValidationError

@Test(expected = IllegalArgumentException.class)
public void testMissingMessage() {
    new ValidationError(Level.ERROR, null);
}


SimpleName:IDENTIFIER 79 expected expected

SimpleName:IDENTIFIER 79 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 80 testMissingMojo testMissingMojo

SimpleName:IDENTIFIER 81 Environment Environment

SimpleName:IDENTIFIER 81 serviceMock serviceMock

@Test(expected = IllegalArgumentException.class)
public void testMissingMojo() {
    new Environment(null, Arrays.asList(serviceMock));
}

package org.eluder.coveralls.maven.plugin;

import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import org.apache.maven.plugin.logging.Log;
import org.eluder.coveralls.maven.plugin.service.ServiceSetup;
import org.eluder.coveralls.maven.plugin.source.SourceLoader;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class adhoc_EnvironmentTest {

    private CoverallsReportMojo mojo;

    @Mock
    private CoverageParser coverageParserMock;

    @Mock
    private Log logMock;

    @Mock
    private ServiceSetup serviceMock;

    @Before
    public void init() throws Exception {
        mojo = new CoverallsReportMojo() {

            @Override
            protected List<CoverageParser> createCoverageParsers(SourceLoader sourceLoader) {
                return Arrays.asList(coverageParserMock);
            }

            @Override
            public Log getLog() {
                return logMock;
            }
        };
        mojo.serviceName = "service";
        mojo.sourceEncoding = "UTF-8";
        when(serviceMock.isSelected()).thenReturn(true);
    }

    private Environment create(final Iterable<ServiceSetup> services) {
        return new Environment(mojo, services);
    }
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 84 expected expected

SimpleName:IDENTIFIER 84 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 85 testMissingServices testMissingServices

SimpleName:IDENTIFIER 86 Environment Environment

@Test(expected = IllegalArgumentException.class)
public void testMissingServices() {
    new Environment(mojo, null);
}


SimpleName:IDENTIFIER 53 expected expected

SimpleName:IDENTIFIER 53 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 54 testAddPropertyWithoutName testAddPropertyWithoutName

SimpleName:IDENTIFIER 55 HashMap HashMap

SimpleName:IDENTIFIER 55 addProperty addProperty

SimpleName:IDENTIFIER 55 Properties Properties

StringLiteralExpr:LITERAL 55 "value" "value"

@Test(expected = IllegalArgumentException.class)
public void testAddPropertyWithoutName() {
    create(new HashMap<String, String>()).addProperty(new Properties(), null, "value");
}

package org.eluder.coveralls.maven.plugin.service;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.junit.Test;

public class adhoc_AbstractServiceSetupTest {

    private AbstractServiceSetup create(final Map<String, String> env) {
        return new AbstractServiceSetup(env) {

            @Override
            public boolean isSelected() {
                return true;
            }

            @Override
            public String getName() {
                return getProperty("CI_NAME");
            }
        };
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 52 expected expected

SimpleName:IDENTIFIER 52 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 53 testMissingCoverallsFile testMissingCoverallsFile

SimpleName:IDENTIFIER 54 DryRunLogger DryRunLogger

@Test(expected = IllegalArgumentException.class)
public void testMissingCoverallsFile() {
    new DryRunLogger(true, null);
}

package org.eluder.coveralls.maven.plugin.logging;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import java.io.File;
import org.apache.maven.plugin.logging.Log;
import org.eluder.coveralls.maven.plugin.logging.Logger.Position;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class adhoc_DryRunLoggerTest {

    @Mock
    private Log logMock;

    @Mock
    private File coverallsFileMock;
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 38 expected expected

SimpleName:IDENTIFIER 38 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 39 testCreateInvalidUrl testCreateInvalidUrl

SimpleName:IDENTIFIER 39 Exception Exception

SimpleName:IDENTIFIER 40 UrlUtils UrlUtils

StringLiteralExpr:LITERAL 40 "sdfds" "sdfds"

@Test(expected = IllegalArgumentException.class)
public void testCreateInvalidUrl() throws Exception {
    UrlUtils.create("sdfds");
}

package org.eluder.coveralls.maven.plugin.util;

import org.junit.Test;
import java.net.URI;
import java.net.URL;
import static org.junit.Assert.assertEquals;

public class adhoc_UrlUtilsTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 48 expected expected

SimpleName:IDENTIFIER 48 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 49 testInvalidUrlToUri testInvalidUrlToUri

SimpleName:IDENTIFIER 49 Exception Exception

SimpleName:IDENTIFIER 50 UrlUtils UrlUtils

@Test(expected = IllegalArgumentException.class)
public void testInvalidUrlToUri() throws Exception {
    UrlUtils.toUri(new URL("http://google.com?q=s|r"));
}


SimpleName:IDENTIFIER 93 expected expected

SimpleName:IDENTIFIER 93 IOException IOException

SimpleName:IDENTIFIER 94 testCreateEmptyParsers testCreateEmptyParsers

SimpleName:IDENTIFIER 94 Exception Exception

SimpleName:IDENTIFIER 95 createCoverageParsersFactory createCoverageParsersFactory

SimpleName:IDENTIFIER 95 createParsers createParsers

@Test(expected = IOException.class)
public void testCreateEmptyParsers() throws Exception {
    createCoverageParsersFactory().createParsers();
}

package org.eluder.coveralls.maven.plugin.util;

import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
import org.apache.maven.model.Reporting;
import org.apache.maven.project.MavenProject;
import org.eluder.coveralls.maven.plugin.CoverageParser;
import org.eluder.coveralls.maven.plugin.parser.CoberturaParser;
import org.eluder.coveralls.maven.plugin.parser.JaCoCoParser;
import org.eluder.coveralls.maven.plugin.parser.SagaParser;
import org.eluder.coveralls.maven.plugin.source.SourceLoader;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class adhoc_CoverageParsersFactoryTest {

    @Rule
    public TemporaryFolder folder = new TemporaryFolder();

    @Mock
    private MavenProject projectMock;

    @Mock
    private SourceLoader sourceLoaderMock;

    @Mock
    private Model modelMock;

    @Mock
    private Reporting reportingMock;

    @Mock
    private Build buildMock;

    private File reportingDir;

    private File targetDir;

    @Before
    public void init() throws Exception {
        reportingDir = folder.newFolder();
        targetDir = folder.newFolder();
        when(projectMock.getCollectedProjects()).thenReturn(Collections.<MavenProject>emptyList());
        when(projectMock.getModel()).thenReturn(modelMock);
        when(projectMock.getBuild()).thenReturn(buildMock);
        when(modelMock.getReporting()).thenReturn(reportingMock);
        when(reportingMock.getOutputDirectory()).thenReturn(reportingDir.getAbsolutePath());
        when(buildMock.getDirectory()).thenReturn(targetDir.getAbsolutePath());
    }

    private CoverageParsersFactory createCoverageParsersFactory() {
        return new CoverageParsersFactory(projectMock, sourceLoaderMock);
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 45 expected expected

SimpleName:IDENTIFIER 45 NullPointerException NullPointerException

SimpleName:IDENTIFIER 46 testAddAllForNull testAddAllForNull

SimpleName:IDENTIFIER 46 Exception Exception

SimpleName:IDENTIFIER 47 ExistingFiles ExistingFiles

{
    new ExistingFiles().addAll(null);
}

@Test(expected = NullPointerException.class)
public void testAddAllForNull() throws Exception {
    new ExistingFiles().addAll(null);
}

{
    new ExistingFiles().addAll(null);
}

package org.eluder.coveralls.maven.plugin.util;

import static org.junit.Assert.*;
import java.io.File;
import java.util.Arrays;
import java.util.Iterator;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

public class adhoc_ExistingFilesTest {

    @Rule
    public TemporaryFolder folder = new TemporaryFolder();

    private static void assertSize(Iterator<?> iter, int size) {
        for (int i = 0; i < size; i++) {
            iter.next();
        }
        assertFalse(iter.hasNext());
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 50 expected expected

SimpleName:IDENTIFIER 50 NullPointerException NullPointerException

SimpleName:IDENTIFIER 51 testAddForNull testAddForNull

SimpleName:IDENTIFIER 51 Exception Exception

SimpleName:IDENTIFIER 52 ExistingFiles ExistingFiles

@Test(expected = NullPointerException.class)
public void testAddForNull() throws Exception {
    new ExistingFiles().add(null);
}


SimpleName:IDENTIFIER 53 expected expected

SimpleName:IDENTIFIER 53 IOException IOException

SimpleName:IDENTIFIER 54 testMissingSource testMissingSource

SimpleName:IDENTIFIER 54 Exception Exception

SimpleName:IDENTIFIER 55 creaMultiSourceLoader creaMultiSourceLoader

StringLiteralExpr:LITERAL 55 "source" "source"

@Test(expected = IOException.class)
public void testMissingSource() throws Exception {
    creaMultiSourceLoader().load("source");
}

package org.eluder.coveralls.maven.plugin.source;

import org.eluder.coveralls.maven.plugin.domain.Source;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import java.io.IOException;
import static org.junit.Assert.assertSame;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class adhoc_MultiSourceLoaderTest {

    @Mock
    private SourceLoader sl1;

    @Mock
    private SourceLoader sl2;

    private Source s1 = new Source("source", "{ 1 }", "9A0174D3A5B8D202C6E404601FC260D1");

    private Source s2 = new Source("source", "{ 2 }", "849409F24F4BCAAC904F3B142447D65D");

    private MultiSourceLoader creaMultiSourceLoader() {
        return new MultiSourceLoader().add(sl1).add(sl2);
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 12 testSimpleApply testSimpleApply

SimpleName:IDENTIFIER 13 HysteresisThreshold HysteresisThreshold

SimpleName:IDENTIFIER 15 MatrixSource MatrixSource

@Test
public void testSimpleApply() {
    Effect effect = new HysteresisThreshold();
    effect.apply(new MatrixSource(1, 2));
}

@Test(expected = IllegalArgumentException.class)
public void testSimpleApply() {
    Effect effect = new HysteresisThreshold();
    effect.apply(new MatrixSource(1, 2));
}

package com.harium.keel.effect;

import com.harium.keel.core.Effect;
import com.harium.keel.core.source.MatrixSource;
import com.harium.keel.core.source.OneBandSource;
import org.junit.Assert;
import org.junit.Test;

public class adhoc_HysteresisThresholdTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 18 testSimpleApplyGrayscale testSimpleApplyGrayscale

SimpleName:IDENTIFIER 19 ColorFiltering ColorFiltering

SimpleName:IDENTIFIER 20 grayscale grayscale

SimpleName:IDENTIFIER 20 OneBandSource OneBandSource

SimpleName:IDENTIFIER 22 grayscale grayscale

@Test
public void testSimpleApplyGrayscale() {
    Effect effect = new ColorFiltering();
    OneBandSource grayscale = new OneBandSource(1, 2);
    effect.apply(grayscale);
}

@Test(expected = IllegalArgumentException.class)
public void testSimpleApplyGrayscale() {
    Effect effect = new ColorFiltering();
    OneBandSource grayscale = new OneBandSource(1, 2);
    effect.apply(grayscale);
}

package com.harium.keel.effect;

import com.harium.keel.core.Effect;
import com.harium.keel.core.source.MatrixSource;
import com.harium.keel.core.source.OneBandSource;
import org.junit.Assert;
import org.junit.Test;

public class adhoc_ColorFilteringTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 13 DifferenceEdgeDetector DifferenceEdgeDetector

@Test
public void testSimpleApply() {
    Effect effect = new DifferenceEdgeDetector();
    effect.apply(new MatrixSource(1, 2));
}

@Test(expected = IllegalArgumentException.class)
public void testSimpleApply() {
    Effect effect = new DifferenceEdgeDetector();
    effect.apply(new MatrixSource(1, 2));
}

package com.harium.keel.effect;

import com.harium.keel.core.Effect;
import com.harium.keel.core.source.MatrixSource;
import com.harium.keel.core.source.OneBandSource;
import org.junit.Assert;
import org.junit.Test;

public class adhoc_DifferenceEdgeDetectorTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 18 testUndefinedStamp testUndefinedStamp

SimpleName:IDENTIFIER 21 MatrixSource MatrixSource

@Test
public void testUndefinedStamp() {
    Effect effect = new Stamp();
    effect.apply(new MatrixSource(1, 2));
}

@Test(expected = RuntimeException.class)
public void testUndefinedStamp() {
    Effect effect = new Stamp();
    effect.apply(new MatrixSource(1, 2));
}

package com.harium.keel.effect;

import com.harium.keel.core.Effect;
import com.harium.keel.core.source.MatrixSource;
import org.junit.Assert;
import org.junit.Test;

public class adhoc_StampTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 12 testSimpleApply testSimpleApply

SimpleName:IDENTIFIER 13 EnsembleThreshold EnsembleThreshold

SimpleName:IDENTIFIER 15 MatrixSource MatrixSource

@Test
public void testSimpleApply() {
    Effect effect = new EnsembleThreshold(new int[] { 1 });
    effect.apply(new MatrixSource(1, 2));
}

@Test(expected = IllegalArgumentException.class)
public void testSimpleApply() {
    Effect effect = new EnsembleThreshold(new int[] { 1 });
    effect.apply(new MatrixSource(1, 2));
}

package com.harium.keel.effect;

import com.harium.keel.core.Effect;
import com.harium.keel.core.source.MatrixSource;
import com.harium.keel.core.source.OneBandSource;
import org.junit.Assert;
import org.junit.Test;

public class adhoc_EnsembleThresholdTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 22 expected expected

SimpleName:IDENTIFIER 22 NumberFormatException NumberFormatException

SimpleName:IDENTIFIER 23 createDefaultEnvironmentServerPort createDefaultEnvironmentServerPort

SimpleName:IDENTIFIER 23 Exception Exception

SimpleName:IDENTIFIER 24 Environment Environment

SimpleName:IDENTIFIER 24 createEnvironment createEnvironment

SimpleName:IDENTIFIER 25 getServerPort getServerPort

@Test(expected = NumberFormatException.class)
public void createDefaultEnvironmentServerPort() throws Exception {
    Environment env = Environment.createEnvironment();
    env.getServerPort();
}

package com.fredhopper.environment;

import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertEquals;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.junit.Test;

public class adhoc_KeyValueEnvironmentTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 41 expected expected

SimpleName:IDENTIFIER 41 NullPointerException NullPointerException

SimpleName:IDENTIFIER 42 ensureEsConfigurationIsNotNull ensureEsConfigurationIsNotNull

SimpleName:IDENTIFIER 43 ManagedEsClient ManagedEsClient

SimpleName:IDENTIFIER 43 EsConfiguration EsConfiguration

@Test(expected = NullPointerException.class)
public void ensureEsConfigurationIsNotNull() {
    new ManagedEsClient((EsConfiguration) null);
}

package io.dropwizard.elasticsearch.managed;

import com.google.common.net.HostAndPort;
import io.dropwizard.configuration.ConfigurationException;
import io.dropwizard.configuration.ConfigurationFactory;
import io.dropwizard.configuration.DefaultConfigurationFactoryFactory;
import io.dropwizard.elasticsearch.config.EsConfiguration;
import io.dropwizard.elasticsearch.util.TransportAddressHelper;
import io.dropwizard.jackson.Jackson;
import io.dropwizard.lifecycle.Managed;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.node.Node;
import org.junit.Test;
import javax.validation.Validation;
import javax.validation.Validator;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

public class adhoc_ManagedEsClientTest {

    private final Validator validator = Validation.buildDefaultValidatorFactory().getValidator();

    private final ConfigurationFactory<EsConfiguration> configFactory = new DefaultConfigurationFactoryFactory<EsConfiguration>().create(EsConfiguration.class, validator, Jackson.newObjectMapper(), "dw");
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 46 expected expected

SimpleName:IDENTIFIER 46 NullPointerException NullPointerException

SimpleName:IDENTIFIER 47 ensureNodeIsNotNull ensureNodeIsNotNull

SimpleName:IDENTIFIER 48 ManagedEsClient ManagedEsClient

{
    new ManagedEsClient((Node) null);
}

@Test(expected = NullPointerException.class)
public void ensureNodeIsNotNull() {
    new ManagedEsClient((Node) null);
}

{
    new ManagedEsClient((Node) null);
}


SimpleName:IDENTIFIER 51 expected expected

SimpleName:IDENTIFIER 51 NullPointerException NullPointerException

SimpleName:IDENTIFIER 52 ensureClientIsNotNull ensureClientIsNotNull

SimpleName:IDENTIFIER 53 ManagedEsClient ManagedEsClient

{
    new ManagedEsClient((Client) null);
}

@Test(expected = NullPointerException.class)
public void ensureClientIsNotNull() {
    new ManagedEsClient((Client) null);
}

{
    new ManagedEsClient((Client) null);
}


SimpleName:IDENTIFIER 20 expected expected

SimpleName:IDENTIFIER 20 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 21 initializationWithoutIndicesShouldFail initializationWithoutIndicesShouldFail

SimpleName:IDENTIFIER 22 EsIndexExistsHealthCheck EsIndexExistsHealthCheck

SimpleName:IDENTIFIER 22 Collections Collections

SimpleName:IDENTIFIER 22 emptyList emptyList

@Test(expected = IllegalArgumentException.class)
public void initializationWithoutIndicesShouldFail() {
    new EsIndexExistsHealthCheck(mock(Client.class), Collections.<String>emptyList());
}

package io.dropwizard.elasticsearch.health;

import com.google.common.collect.ImmutableList;
import org.elasticsearch.client.Client;
import org.junit.Test;
import java.util.Collections;
import static org.mockito.Mockito.mock;

public class adhoc_EsIndexExistsHealthCheckTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 21 expected expected

SimpleName:IDENTIFIER 21 NullPointerException NullPointerException

SimpleName:IDENTIFIER 22 fromHostAndPortWithNullShouldFail fromHostAndPortWithNullShouldFail

SimpleName:IDENTIFIER 23 TransportAddressHelper TransportAddressHelper

SimpleName:IDENTIFIER 23 fromHostAndPort fromHostAndPort

@Test(expected = NullPointerException.class)
public void fromHostAndPortWithNullShouldFail() {
    TransportAddressHelper.fromHostAndPort(null);
}

package io.dropwizard.elasticsearch.util;

import com.google.common.collect.ImmutableList;
import com.google.common.net.HostAndPort;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.common.transport.TransportAddress;
import org.junit.Test;
import java.util.Collections;
import java.util.List;
import static org.junit.Assert.assertEquals;

public class adhoc_TransportAddressHelperTest {

    private static final int ES_DEFAULT_PORT = 9300;
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 40 UnsafeCacheValue UnsafeCacheValue

StringLiteralExpr:LITERAL
41
"hello world"
"hello world"

SimpleName:IDENTIFIER 41 getBytes getBytes

@Test
public void test2() {
    UnsafeCacheValue value = new UnsafeCacheValue(10);
    byte[] buf = "hello world".getBytes();
    value.write(0, buf, 0, 11);
}

@Test(expected = ArrayIndexOutOfBoundsException.class)
public void test2() {
    UnsafeCacheValue value = new UnsafeCacheValue(10);
    byte[] buf = "hello world".getBytes();
    value.write(0, buf, 0, 11);
}

package com.bah.lucene.blockcache_v2.cachevalue;

import static org.junit.Assert.*;
import org.junit.Test;
import com.bah.lucene.blockcache_v2.cachevalue.UnsafeCacheValue;

public class adhoc_UnsafeCacheValueTest {
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 51 UnsafeCacheValue UnsafeCacheValue

StringLiteralExpr:LITERAL
52
"hello world"
"hello world"

SimpleName:IDENTIFIER 52 getBytes getBytes

@Test
public void test3() {
    UnsafeCacheValue value = new UnsafeCacheValue(10);
    byte[] buf = "hello world".getBytes();
    value.write(8, buf, 0, 3);
}

@Test(expected = ArrayIndexOutOfBoundsException.class)
public void test3() {
    UnsafeCacheValue value = new UnsafeCacheValue(10);
    byte[] buf = "hello world".getBytes();
    value.write(8, buf, 0, 3);
}

SimpleName:IDENTIFIER 40 ByteArrayCacheValue ByteArrayCacheValue

@Test
public void test2() {
    ByteArrayCacheValue value = new ByteArrayCacheValue(10);
    byte[] buf = "hello world".getBytes();
    value.write(0, buf, 0, 11);
}

@Test(expected = ArrayIndexOutOfBoundsException.class)
public void test2() {
    ByteArrayCacheValue value = new ByteArrayCacheValue(10);
    byte[] buf = "hello world".getBytes();
    value.write(0, buf, 0, 11);
}

package com.bah.lucene.blockcache_v2.cachevalue;

import static org.junit.Assert.*;
import org.junit.Test;
import com.bah.lucene.blockcache_v2.cachevalue.ByteArrayCacheValue;

public class adhoc_ByteArrayCacheValueTest {
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 51 ByteArrayCacheValue ByteArrayCacheValue

@Test
public void test3() {
    ByteArrayCacheValue value = new ByteArrayCacheValue(10);
    byte[] buf = "hello world".getBytes();
    value.write(8, buf, 0, 3);
}

@Test(expected = ArrayIndexOutOfBoundsException.class)
public void test3() {
    ByteArrayCacheValue value = new ByteArrayCacheValue(10);
    byte[] buf = "hello world".getBytes();
    value.write(8, buf, 0, 3);
}


SimpleName:IDENTIFIER 66 expected expected

SimpleName:IDENTIFIER 66 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 69 RequestBuilder RequestBuilder

SimpleName:IDENTIFIER 69 getReisadviesRequestBuilder getReisadviesRequestBuilder

StringLiteralExpr:LITERAL 69 "Amsterdam" "Amsterdam"

StringLiteralExpr:LITERAL 69 "Utrecht" "Utrecht"

SimpleName:IDENTIFIER 69 forArrivalTime forArrivalTime

SimpleName:IDENTIFIER 69 forDepartureTime forDepartureTime

@Test(expected = IllegalArgumentException.class)
public void testGetReisadviesRequestBuilderArrivalAndDeparture() {
    Date now = new Date();
    RequestBuilder.getReisadviesRequestBuilder("Amsterdam", "Utrecht").forArrivalTime(now).forDepartureTime(now).build();
}

package nl.pvanassen.ns;

import nl.pvanassen.ns.model.prijzen.Prijzen;
import nl.pvanassen.ns.model.reisadvies.ReisMogelijkheden;
import nl.pvanassen.ns.model.stations.Stations;
import nl.pvanassen.ns.model.storingen.Storingen;
import nl.pvanassen.ns.model.vertrektijden.VertrekkendeTreinen;
import org.junit.Assert;
import org.junit.Test;
import java.text.SimpleDateFormat;
import java.util.Date;
import static org.junit.Assert.assertEquals;

public class adhoc_RequestBuilderTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 11 expected expected

SimpleName:IDENTIFIER 11 NullPointerException NullPointerException

SimpleName:IDENTIFIER 12 testNsApiNull testNsApiNull

@Test(expected = NullPointerException.class)
public void testNsApiNull() {
    new NsApi(null, null);
}

package nl.pvanassen.ns;

import nl.pvanassen.ns.error.NsApiException;
import nl.pvanassen.ns.model.NsResult;
import org.junit.Test;
import java.io.IOException;

public class adhoc_NsApiTest {
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 16 expected expected

SimpleName:IDENTIFIER 16 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 17 testNsApiEmpty testNsApiEmpty

@Test(expected = IllegalArgumentException.class)
public void testNsApiEmpty() {
    new NsApi("", "");
}


SimpleName:IDENTIFIER 34 expected expected

SimpleName:IDENTIFIER 34 IllegalStateException IllegalStateException

SimpleName:IDENTIFIER 35 builderThrowsWithMissingMavenProject builderThrowsWithMissingMavenProject

SimpleName:IDENTIFIER 35 Exception Exception

SimpleName:IDENTIFIER 36 builder builder

SimpleName:IDENTIFIER 36 MapVariableResolver MapVariableResolver

SimpleName:IDENTIFIER 39 mockMavenProject mockMavenProject

SimpleName:IDENTIFIER 39 Mockito Mockito

SimpleName:IDENTIFIER 39 MavenProject MavenProject

SimpleName:IDENTIFIER 40 expectedBaseDir expectedBaseDir

SimpleName:IDENTIFIER 40 FileUtils FileUtils

SimpleName:IDENTIFIER 40 getTempDirectory getTempDirectory

SimpleName:IDENTIFIER 41 Mockito Mockito

SimpleName:IDENTIFIER 41 mockMavenProject mockMavenProject

SimpleName:IDENTIFIER 41 getBasedir getBasedir

SimpleName:IDENTIFIER 41 thenReturn thenReturn

SimpleName:IDENTIFIER 41 expectedBaseDir expectedBaseDir

SimpleName:IDENTIFIER 43 mockMavenProperties mockMavenProperties

SimpleName:IDENTIFIER 43 Properties Properties

SimpleName:IDENTIFIER 44 Mockito Mockito

SimpleName:IDENTIFIER 44 mockMavenProject mockMavenProject

SimpleName:IDENTIFIER 44 getProperties getProperties

SimpleName:IDENTIFIER 44 thenReturn thenReturn

SimpleName:IDENTIFIER 44 mockMavenProperties mockMavenProperties

SimpleName:IDENTIFIER 47 mockSystemProperties mockSystemProperties

SimpleName:IDENTIFIER 47 Properties Properties

SimpleName:IDENTIFIER 49 builder builder

SimpleName:IDENTIFIER 50 withName withName

StringLiteralExpr:LITERAL 50 "Name" "Name"

SimpleName:IDENTIFIER 51 withVersion withVersion

SimpleName:IDENTIFIER 52 withSystemProperties withSystemProperties

SimpleName:IDENTIFIER 52 mockSystemProperties mockSystemProperties

SimpleName:IDENTIFIER 53 withBuildDirectory withBuildDirectory

StringLiteralExpr:LITERAL 53 "aDirectory" "aDirectory"

@Test(expected = IllegalStateException.class)
public void builderThrowsWithMissingMavenProject() throws Exception {
    MapVariableResolverBuilder builder = MapVariableResolver.builder();
    MavenProject mockMavenProject = Mockito.mock(MavenProject.class);
    File expectedBaseDir = FileUtils.getTempDirectory();
    Mockito.when(mockMavenProject.getBasedir()).thenReturn(expectedBaseDir);
    Properties mockMavenProperties = new Properties();
    Mockito.when(mockMavenProject.getProperties()).thenReturn(mockMavenProperties);
    Properties mockSystemProperties = new Properties();
    builder.withName("Name").withVersion("2.0.0").withSystemProperties(mockSystemProperties).withBuildDirectory("aDirectory").build();
}

package org.vafer.jdeb.utils;

import java.io.File;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Properties;
import org.apache.commons.io.FileUtils;
import org.apache.maven.model.Organization;
import org.apache.maven.project.MavenProject;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import org.vafer.jdeb.utils.MapVariableResolver.MapVariableResolverBuilder;

public final class adhoc_MapVariableResolverTestCase extends Assert {
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 57 expected expected

SimpleName:IDENTIFIER 57 IllegalStateException IllegalStateException

SimpleName:IDENTIFIER 58 Exception Exception

SimpleName:IDENTIFIER 59 builder builder

SimpleName:IDENTIFIER 59 MapVariableResolver MapVariableResolver

SimpleName:IDENTIFIER 62 mockMavenProject mockMavenProject

SimpleName:IDENTIFIER 62 Mockito Mockito

SimpleName:IDENTIFIER 62 MavenProject MavenProject

SimpleName:IDENTIFIER 63 expectedBaseDir expectedBaseDir

SimpleName:IDENTIFIER 63 FileUtils FileUtils

SimpleName:IDENTIFIER 63 getTempDirectory getTempDirectory

SimpleName:IDENTIFIER 64 Mockito Mockito

SimpleName:IDENTIFIER 64 mockMavenProject mockMavenProject

SimpleName:IDENTIFIER 64 getBasedir getBasedir

SimpleName:IDENTIFIER 64 thenReturn thenReturn

SimpleName:IDENTIFIER 64 expectedBaseDir expectedBaseDir

SimpleName:IDENTIFIER 66 mockMavenProperties mockMavenProperties

SimpleName:IDENTIFIER 66 Properties Properties

SimpleName:IDENTIFIER 67 Mockito Mockito

SimpleName:IDENTIFIER 67 mockMavenProject mockMavenProject

SimpleName:IDENTIFIER 67 getProperties getProperties

SimpleName:IDENTIFIER 67 thenReturn thenReturn

SimpleName:IDENTIFIER 67 mockMavenProperties mockMavenProperties

SimpleName:IDENTIFIER 69 builder builder

SimpleName:IDENTIFIER 70 withName withName

StringLiteralExpr:LITERAL 70 "Name" "Name"

SimpleName:IDENTIFIER 71 withVersion withVersion

SimpleName:IDENTIFIER 72 withMavenProject withMavenProject

SimpleName:IDENTIFIER 72 mockMavenProject mockMavenProject

SimpleName:IDENTIFIER 73 withBuildDirectory withBuildDirectory

StringLiteralExpr:LITERAL 73 "aDirectory" "aDirectory"

@Test(expected = IllegalStateException.class)
public void builderThrowsWithMissingSystemProperties() throws Exception {
    MapVariableResolverBuilder builder = MapVariableResolver.builder();
    MavenProject mockMavenProject = Mockito.mock(MavenProject.class);
    File expectedBaseDir = FileUtils.getTempDirectory();
    Mockito.when(mockMavenProject.getBasedir()).thenReturn(expectedBaseDir);
    Properties mockMavenProperties = new Properties();
    Mockito.when(mockMavenProject.getProperties()).thenReturn(mockMavenProperties);
    builder.withName("Name").withVersion("2.0.0").withMavenProject(mockMavenProject).withBuildDirectory("aDirectory").build();
}


SimpleName:IDENTIFIER 52 testFailOnUnknownValue testFailOnUnknownValue

SimpleName:IDENTIFIER 52 IOException IOException

SimpleName:IDENTIFIER 54 missingFile missingFile

SimpleName:IDENTIFIER 55 setMissingSrc setMissingSrc

StringLiteralExpr:LITERAL
55
"not a value value"
"not a value value"

SimpleName:IDENTIFIER 56 produce produce

@Test
public void testFailOnUnknownValue() throws IOException {
    data.setSrc(missingFile);
    data.setMissingSrc("not a value value");
    data.produce(null);
}

@Test(expected = IllegalArgumentException.class)
public void testFailOnUnknownValue() throws IOException {
    data.setSrc(missingFile);
    data.setMissingSrc("not a value value");
    data.produce(null);
}

package org.vafer.jdeb.maven;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.Assert;

public final class adhoc_DataTestCase extends Assert {

    private Data data;

    private File missingFile;

    private File file;

    @Before
    public void setUp() throws Exception {
        data = new Data();
        missingFile = new File("this-file-does-not-exist");
        file = File.createTempFile(getClass().getSimpleName(), "dat");
    }

    @After
    public void tearDown() throws Exception {
        if (file != null) {
            file.delete();
        }
    }
    /*TEST PLACEHOLDER*/
}