### Question:
ChartCsvGenerator { public String[] generateHeader(ChartCode chartCode, AnalysisForm analysisForm, Locale locale) { Preconditions.checkNotNull(chartCode); Preconditions.checkNotNull(analysisForm); Preconditions.checkNotNull(locale); List<String> columnHeaders = Lists.newArrayList(); if (chartCode == ChartCode.CC_COURT_CHART) { columnHeaders.add(messageSource.getMessage(COLUMN_HEADER_FROM_X_AXIS__COURT_NAME, null, locale)); } else { columnHeaders.add(messageSource.getMessage(COLUMN_HEADER_FROM_X_AXIS__PERIOD, null, locale)); } for (JudgmentSeriesFilter seriesFilter : analysisForm.getSeriesFilters()) { columnHeaders.add(generateColumnHeaderFromSeries(analysisForm.getYsettings().getValueType(), seriesFilter, locale)); } return columnHeaders.toArray(new String[columnHeaders.size()]); }  String[] generateHeader(ChartCode chartCode, AnalysisForm analysisForm, Locale locale); String[] generateRow(Chart<Object, Number> chart, int rowNumber); @Autowired @Qualifier("csvPointValueFormatterManager") void setPointValueFormatterManager(PointValueFormatterManager pointValueFormatterManager); @Autowired void setMessageSource(MessageSource messageSource);  }### Answer:
@Test(expected = NullPointerException.class) public void generateHeader_NULL_CHART_CODE() { chartCsvGenerator.generateHeader(null, analysisForm, locale); }
@Test(expected = NullPointerException.class) public void generateHeader_NULL_ANALYSIS_FORM() { chartCsvGenerator.generateHeader(ChartCode.MAIN_CHART, null, locale); }
@Test(expected = NullPointerException.class) public void generateHeader_NULL_LOCALE() { chartCsvGenerator.generateHeader(ChartCode.MAIN_CHART, analysisForm, null); }
@Test public void generateHeader_MAIN_CHART() { String[] header = chartCsvGenerator.generateHeader(ChartCode.MAIN_CHART, analysisForm, locale); assertEquals(3, header.length); assertEquals("Period", header[0]); assertEquals("JudgmentCount (phrase1)", header[1]); assertEquals("JudgmentCount", header[2]); }
@Test public void generateHeader_CC_COURT_CHART() { String[] header = chartCsvGenerator.generateHeader(ChartCode.CC_COURT_CHART, analysisForm, locale); assertEquals(3, header.length); assertEquals("Court", header[0]); assertEquals("JudgmentCount (phrase1)", header[1]); assertEquals("JudgmentCount", header[2]); }
@Test public void generateHeader_PERCENT() { analysisForm.getYsettings().setValueType(UiyValueType.PERCENT); String[] header = chartCsvGenerator.generateHeader(ChartCode.MAIN_CHART, analysisForm, locale); assertEquals(3, header.length); assertEquals("Period", header[0]); assertEquals("JudgmentPercent (phrase1)", header[1]); assertEquals("JudgmentPercent", header[2]); }
@Test public void generateHeader_NUMBER_PER_1000() { analysisForm.getYsettings().setValueType(UiyValueType.NUMBER_PER_1000); String[] header = chartCsvGenerator.generateHeader(ChartCode.MAIN_CHART, analysisForm, locale); assertEquals(3, header.length); assertEquals("Period", header[0]); assertEquals("JudgmentPer1000Judgments (phrase1)", header[1]); assertEquals("JudgmentPer1000Judgments", header[2]); }