WifExporter { public WifExporter addAll() { for (BitmessageAddress identity : ctx.addresses().getIdentities()) { addIdentity(identity); } return this; } WifExporter(BitmessageContext ctx); WifExporter addAll(); WifExporter addAll(Collection<BitmessageAddress> identities); WifExporter addIdentity(BitmessageAddress identity); void write(File file); void write(OutputStream out); @Override String toString();  }
@Test public void testAddAll() throws Exception { when(repo.getIdentities()).thenReturn(importer.getIdentities()); exporter.addAll(); String result = exporter.toString(); int count = 0; for (int i = 0; i < result.length(); i++) { if (result.charAt(i) == '[') count++; } assertEquals(importer.getIdentities().size(), count); }