@Test public void testNestedSave() throws Exception { OurConnectionSource cs = new OurConnectionSource(); DatabaseConnection conn = cs.getReadOnlyConnection(null); cs.saveSpecialConnection(conn); cs.saveSpecialConnection(conn); cs.clearSpecialConnection(conn); assertEquals(conn, cs.getSpecialConnection(null)); cs.close(); }
@Override public DatabaseConnection getSpecialConnection(String tableName) { NestedConnection currentSaved = specialConnection.get(); if (currentSaved == null) { return null; } else { return currentSaved.connection; } }
BaseConnectionSource implements ConnectionSource { @Override public DatabaseConnection getSpecialConnection(String tableName) { NestedConnection currentSaved = specialConnection.get(); if (currentSaved == null) { return null; } else { return currentSaved.connection; } } }
BaseConnectionSource implements ConnectionSource { @Override public DatabaseConnection getSpecialConnection(String tableName) { NestedConnection currentSaved = specialConnection.get(); if (currentSaved == null) { return null; } else { return currentSaved.connection; } }  }
BaseConnectionSource implements ConnectionSource { @Override public DatabaseConnection getSpecialConnection(String tableName) { NestedConnection currentSaved = specialConnection.get(); if (currentSaved == null) { return null; } else { return currentSaved.connection; } }  @Override DatabaseConnection getSpecialConnection(String tableName); }
BaseConnectionSource implements ConnectionSource { @Override public DatabaseConnection getSpecialConnection(String tableName) { NestedConnection currentSaved = specialConnection.get(); if (currentSaved == null) { return null; } else { return currentSaved.connection; } }  @Override DatabaseConnection getSpecialConnection(String tableName);  }