### Question:
CachedSpawnDataStore implements SpawnDataStore { @Override public List<String> getChildrenNames(String path) { return dataStore.getChildrenNames(path); } CachedSpawnDataStore(SpawnDataStore dataStore, long dataStoreCacheSize); @Override String getDescription(); @Override String get(String path); @Override Map<String, String> get(String[] paths); @Override void put(String path, String value); @Override void putAsChild(String parent, String childId, String value); @Override String getChild(String parent, String childId); @Override void deleteChild(String parent, String childId); @Override void delete(String path); @Override List<String> getChildrenNames(String path); @Override Map<String, String> getAllChildren(String path); @Override void close();  }### Answer:
@Test public void testGetChildrenNames() throws SQLException { final PreparedStatement selectPreparedStatement = Mockito.mock(PreparedStatement.class); Mockito.doReturn(selectPreparedStatement).when(connection).prepareStatement(Mockito.startsWith("SELECT DISTINCT ")); final ResultSet resultSet = Mockito.mock(ResultSet.class); Mockito.when(selectPreparedStatement.executeQuery()).thenReturn(resultSet); Mockito.when(resultSet.next()).thenReturn(Boolean.TRUE, Boolean.TRUE, Boolean.FALSE); Mockito.when(resultSet.getString(1)).thenReturn("value1", "value2"); final List<String> result = cachedDataStore.getChildrenNames("key"); assertNotNull(result); assertEquals(2, result.size()); assertEquals("value1", result.get(0)); assertEquals("value2", result.get(1)); Mockito.verify(selectPreparedStatement, Mockito.atLeastOnce()).executeQuery(); Mockito.verify(selectPreparedStatement).setString(Mockito.eq(1), Mockito.eq("key")); Mockito.verify(selectPreparedStatement).setString(Mockito.eq(2), Mockito.eq("_root")); }