ValueFormatter { public String getString(String name) { Object value = get(data, row, name); return value != null ? String.valueOf(value) : DASH; } ValueFormatter(Data data, Row row); String getString(String name); String getString(Map<String, String> names);  }
@Test public void testGetString() { Data data = new Data(); data.setColumnNames(Arrays.asList("not-null", "nullable")); Row row = new Row(); row.getValues().addAll(Arrays.asList("value", null)); data.setRows(Collections.singletonList(row)); ValueFormatter valueFormatter = new ValueFormatter(data, row); assertThat(valueFormatter.getString("not-null"), equalTo("value")); assertThat(valueFormatter.getString("nullable"), equalTo("-")); assertThat(valueFormatter.getString(new HashMap<String, String>() { { put("not-null", "Name"); put("nullable", "Anything"); } }), equalTo("Name: value")); assertThat(valueFormatter.getString(new HashMap<String, String>() { { put("nullable", "Anything"); } }), equalTo("-")); }