### Question:
CachedSpawnDataStore implements SpawnDataStore { @Override public void putAsChild(String parent, String childId, String value) throws Exception { dataStore.putAsChild(parent, childId, value); cache.put(ImmutablePair.of(parent, childId), value); } 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 testPutAsChild() throws Exception { final PreparedStatement insertPreparedStatement = Mockito.mock(PreparedStatement.class); Mockito.doReturn(insertPreparedStatement).when(connection).prepareStatement(Mockito.startsWith("REPLACE INTO ")); Mockito.doAnswer((Answer) (InvocationOnMock invocation) -> { final Blob blob = (Blob)invocation.getArguments()[1]; assertEquals(new String(blob.getBytes(1l, (int) blob.length())), "value"); return null; }).when(insertPreparedStatement).setBlob(Mockito.eq(2), Mockito.any(Blob.class)); cachedDataStore.putAsChild("key", "childId", "value"); Mockito.verify(insertPreparedStatement).setString(Mockito.eq(1), Mockito.eq("key")); Mockito.verify(insertPreparedStatement).setBlob(Mockito.eq(2), Mockito.any(Blob.class)); Mockito.verify(insertPreparedStatement).setString(Mockito.eq(3), Mockito.eq("childId")); Mockito.verify(insertPreparedStatement, Mockito.atLeastOnce()).execute(); }