### Question:
ResultSetHelperService implements ResultSetHelper { public String[] getColumnNames(ResultSet rs) throws SQLException { List<String> names = new ArrayList<String>(); ResultSetMetaData metadata = rs.getMetaData(); for (int i = 0; i < metadata.getColumnCount(); i++) { names.add(metadata.getColumnName(i + 1)); } String[] nameArray = new String[names.size()]; return names.toArray(nameArray); }  String[] getColumnNames(ResultSet rs); String[] getColumnValues(ResultSet rs); String[] getColumnValues(ResultSet rs, boolean trim); String[] getColumnValues(ResultSet rs, boolean trim, String dateFormatString, String timeFormatString); static final int CLOBBUFFERSIZE; static final int NVARCHAR; static final int NCHAR; static final int LONGNVARCHAR; static final int NCLOB; }### Answer:
@Test public void canPrintColumnNames() throws SQLException { ResultSet resultSet = Mockito.mock(ResultSet.class); String[] expectedNames = {"name1", "name2", "name3"}; ResultSetMetaData metaData = MockResultSetMetaDataBuilder.buildMetaData(expectedNames); Mockito.when(resultSet.getMetaData()).thenReturn(metaData); ResultSetHelperService service = new ResultSetHelperService(); String[] columnNames = service.getColumnNames(resultSet); Assert.assertArrayEquals(expectedNames, columnNames); }