### Question:
CsvRow { public String getField(String header) { Integer index = findIndex(header); if (index == null) { throw new IllegalArgumentException("Header not found: '" + header + "'"); } return field(index); } private  CsvRow(ImmutableList<String> headers, int lineNumber, ImmutableList<String> fields);   CsvRow(
      ImmutableList<String> headers,
      ImmutableMap<String, Integer> searchHeaders,
      int lineNumber,
      ImmutableList<String> fields); ImmutableList<String> headers(); int lineNumber(); ImmutableList<String> fields(); int fieldCount(); String field(int index); String getField(String header); T getField(String header, Function<String, T> postProcessor); Optional<String> findField(String header); String getField(Pattern headerPattern); T getField(Pattern headerPattern, Function<String, T> postProcessor); Optional<String> findField(Pattern headerPattern); String getValue(String header); T getValue(String header, Function<String, T> postProcessor); Optional<String> findValue(String header); String getValue(Pattern headerPattern); T getValue(Pattern headerPattern, Function<String, T> postProcessor); Optional<String> findValue(Pattern headerPattern); CsvRow subRow(int startInclusive); CsvRow subRow(int startInclusive, int endExclusive); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void test_getField_String() { CsvRow row = new CsvRow(HEADERS, SEARCH_HEADERS, 1, FIELDS); assertThat(row.getField("A")).isEqualTo("m"); assertThat(row.getField("B")).isEqualTo(""); assertThatIllegalArgumentException().isThrownBy(() -> row.getField("X")); assertThat(row.getField("C", Period::parse)).isEqualTo(Period.ofDays(1)); assertThatIllegalArgumentException().isThrownBy(() -> row.getField("C", Integer::parseInt)); assertThatIllegalArgumentException().isThrownBy(() -> row.getField("X", Period::parse)); }
@Test public void test_getField_Pattern() { CsvRow row = new CsvRow(HEADERS, SEARCH_HEADERS, 1, FIELDS); assertThat(row.getField(Pattern.compile("A"))).isEqualTo("m"); assertThat(row.getField(Pattern.compile("B"))).isEqualTo(""); assertThatIllegalArgumentException().isThrownBy(() -> row.getField(Pattern.compile("X"))); assertThat(row.getField(Pattern.compile("C"), Period::parse)).isEqualTo(Period.ofDays(1)); assertThatIllegalArgumentException().isThrownBy(() -> row.getField(Pattern.compile("C"), Integer::parseInt)); assertThatIllegalArgumentException().isThrownBy(() -> row.getField(Pattern.compile("X"), Period::parse)); }