DefaultWXStorage implements IWXStorageAdapter { @Override public void length(final OnResultReceivedListener listener) { execute(new Runnable() { @Override public void run() { Map<String, Object> data = StorageResultHandler.getLengthResult(performGetLength()); if(listener == null){ return; } listener.onReceived(data); } }); } DefaultWXStorage(Context context); @Override void setItem(final String key, final String value, final OnResultReceivedListener listener); @Override void getItem(final String key, final OnResultReceivedListener listener); @Override void removeItem(final String key, final OnResultReceivedListener listener); @Override void length(final OnResultReceivedListener listener); @Override void getAllKeys(final OnResultReceivedListener listener); @Override void setItemPersistent(final String key, final String value, final OnResultReceivedListener listener); @Override void close();  }
@Test public void testLength() throws Exception { storage.length(listener); verify(listener,timeout(3000).times(1)).onReceived(anyMapOf(String.class,Object.class)); storage.close(); }