### Question:
TSpace implements LocalSpace<K,V>, Loggeable, Runnable { @Override public void dump(PrintStream p, String indent) { Object[] keys; int size = entries.size(); if (size > MAX_ENTRIES_IN_DUMP * 100) { p.printf ("%sWARNING - space too big, size=%d%n", indent, size); return; } synchronized (this) { keys = entries.keySet().toArray(); } int i=0; for (Object key : keys) { p.printf("%s<key count='%d'>%s</key>%n", indent, size(key), key); if (i++ > MAX_ENTRIES_IN_DUMP) { p.printf ("%s...%n", indent); p.printf ("%s...%n", indent); break; } } p.printf("%s key-count: %d%n", indent, keys.length); int exp0, exp1; synchronized (this) { exp0 = expirables[0].size(); exp1 = expirables[1].size(); } p.printf("%s gcinfo: %d,%d%n", indent, exp0, exp1); } TSpace(); @Override void out(K key, V value); @Override void out(K key, V value, long timeout); @Override synchronized V rdp(Object key); @Override synchronized V inp(Object key); @Override synchronized V in(Object key); @Override synchronized V in(Object key, long timeout); @Override synchronized V rd(Object key); @Override synchronized V rd(Object key, long timeout); @Override synchronized void nrd(Object key); @Override synchronized V nrd(Object key, long timeout); @Override void run(); void gc(); @Override synchronized int size(Object key); @Override synchronized void addListener(Object key, SpaceListener listener); @Override synchronized void addListener(Object key, SpaceListener listener, long timeout); @Override synchronized void removeListener(Object key, SpaceListener listener); boolean isEmpty(); @Override synchronized Set<K> getKeySet(); String getKeysAsString(); @Override void dump(PrintStream p, String indent); void notifyListeners(Object key, Object value); @Override void push(K key, V value); @Override void push(K key, V value, long timeout); @Override void put(K key, V value); @Override void put(K key, V value, long timeout); @Override boolean existAny(K[] keys); @Override boolean existAny(K[] keys, long timeout); Map getEntries(); void setEntries(Map entries); static final long GCDELAY; }### Answer:
@Test public void testDump() throws Throwable { TSpace tSpace = new TSpace(); tSpace.out("", "testString"); tSpace.out(Integer.valueOf(0), Integer.valueOf(-1)); tSpace.out(Integer.valueOf(31), ""); PrintStream p = new PrintStream(new ByteArrayOutputStream(), true); tSpace.dump(p, "testTSpaceIndent"); assertEquals(3, tSpace.entries.size(), "tSpace.entries.size()"); }